Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
crashdome
Jun 28, 2011

Scaramouche posted:

Any of you guys ever had to programmatically connect to Google drive and grab the content for use/insertion into a database?

I've never done Google but, I've done Excel from Office 365 using basic Office libraries and one step even better... I programmatically pull data from an Access Web App that has a UI front end for data entry. It's basically as simple as a SQL connection to a free azure hosted database.

Adbot
ADBOT LOVES YOU

Inverness
Feb 4, 2009

Fully configurable personal assistant.

Ithaqua posted:

VS2015 CTP 6 came out earlier today, along with the first CTP of TFS 2015, with all the awesome new build stuff.
It seems they re-added the object ID feature in the debugger.

This makes me wonder why the hell they removed it in the first place.

RICHUNCLEPENNYBAGS
Dec 21, 2010

Scaramouche posted:

Any of you guys ever had to programmatically connect to Google drive and grab the content for use/insertion into a database? We've got a marketplace that we're doing good sales on, but they have zero automation for sales reporting, order importing, etc. So the way our staff keep track of them is to update a Google Spreadsheet Doc. The idea being I'd connect to Drive, open this sheet, and grab new rows and put them in the database.

I've found and am messing around with this:
https://developers.google.com/resources/api-libraries/documentation/drive/v2/csharp/latest/annotated.html

But am just wondering if anyone else has done it and if they have any 'gotchas' or advice.

The .NET libraries are loving awful because they're just maintained by one guy who constanlty keeps changing how the auth and stuff works so it ends up being easier to just mess with the REST stuff yourself. That's how I remember working with the Google Apps stuff.

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost

Ithaqua posted:

VS2015 CTP 6 came out earlier today, along with the first CTP of TFS 2015, with all the awesome new build stuff.

Xamarin is also an install option in the custom install now too. Making it just that little bit easier to go on and give it a try. :)

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

RICHUNCLEPENNYBAGS posted:

The .NET libraries are loving awful because they're just maintained by one guy who constanlty keeps changing how the auth and stuff works so it ends up being easier to just mess with the REST stuff yourself. That's how I remember working with the Google Apps stuff.

I think I get what you mean; I did a similar thing with translate however instead of including a bunch of references and creating a bunch of classes I ended up curl'ing the URL I wanted and pushing it in, and then grabbing what I needed out of the resulting JSON. So it sounds like you're saying that's the case here too?

RICHUNCLEPENNYBAGS
Dec 21, 2010

Scaramouche posted:

I think I get what you mean; I did a similar thing with translate however instead of including a bunch of references and creating a bunch of classes I ended up curl'ing the URL I wanted and pushing it in, and then grabbing what I needed out of the resulting JSON. So it sounds like you're saying that's the case here too?

That's probably better unless the .NET libs have gotten much better in the past couple years.

ljw1004
Jan 18, 2005

rum

Inverness posted:

It seems they re-added the object ID feature in the debugger.
This makes me wonder why the hell they removed it in the first place.

It was never removed. What we've done is regularize it and tell people about it!
http://blogs.msdn.com/b/csharpfaq/archive/2015/02/23/edit-and-continue-and-make-object-id-improvements-in-ctp-6.aspx

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Ithaqua posted:

VS2015 CTP 6 came out earlier today, along with the first CTP of TFS 2015, with all the awesome new build stuff.

Forget TFS and awesome new build stuff. The real goods are //todo support in javascript.

sausage king of Chicago
Jun 13, 2001
Does anyone have any recommendations on a report generating tool with a snazzy UI? I'm looking for something where you can define fields(like "products delivered over a given date range") for users, and they can click and drag those defined fields to generate spreadsheets, graphs, etc.

fankey
Aug 31, 2001

Given the following
C# code:
  class A
  {
    public string Name { get; set; }
  }

  class B : A
  {
    List<A> _Items = new List<A>();
    public List<A> Items
    {
      get { return _Items; }
    }
  }

  class C : IEnumerable<A>
  {
    List<A> _Items = new List<A>();
    public C()
    {
      _Items.Add(new A() { Name = "A1" });
      _Items.Add(new A() { Name = "A2" });
      B b1 = new B();
      b1.Items.Add(new A() { Name = "B1 A1" });
      b1.Items.Add(new A() { Name = "B1 A2" });
      _Items.Add(b1);
      _Items.Add(new A() { Name = "A3" });
      B b2 = new B();
      b2.Items.Add(new A() { Name = "B2 A1" });
      b2.Items.Add(new A() { Name = "B2 A2" });
      _Items.Add(b2);
      _Items.Add(new A() { Name = "A4" });
    }
    public IEnumerator<A> GetEnumerator()
    {
      return _Items.GetEnumerator();
    }
Is there a way to use LINQ to make C:GetEnumerator return something that would not include B but traverse through B ? I'd like the output to be
code:
A1
A2
B1 A1
B1 A2
A3
B2 A1
B2 A2
A4

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
C# code:
public IEnumerator<A> GetEnumerator()
{
    return _Items.SelectMany(GetItems).GetEnumerator();
}

private IEnumerable<A> GetItems(A item) {
    var b = item as B;
    if (b != null)
    {
        foreach(var bItem in b.Items)
            yield return bItem;
    }
    else
    {
        yield return item;
    }
}
Check it out here: https://dotnetfiddle.net/YpgVVi

EDIT: I should probably ask, what are you trying to do? This may not be the best way of going about things.

Bognar fucked around with this message at 22:49 on Feb 24, 2015

JawnV6
Jul 4, 2004

So hot ...
I have a reference application in C++ that uses a DLL for a USB device. It needs to integrate with a C# app I'm already building. I wanted to just import the DLL into C#, but I'm hitting errors I haven't seen before and hit my limits on google/SO.

When I try to grab the DLLthrough Reference Manager, the error pops up as "A reference to "dll_name.dll" could not be added. Please make sure the file is accessible, and that it is a valid assembly or COM component." This led me to a SO answer suggesting TlbImp.exe, which gives me

quote:

Microsoft (R) .NET Framework Type Library to Assembly Converter 3.5.30729.1
Copyright (C) Microsoft Corporation. All rights reserved.

TlbImp : error TI0000 : The input file 'dll_name.dll' is not a valid type library.
Now I'm neck deep in Dependency Walker and seeing a lot of API-MS-WIN-CORE-*, which seems to be a legacy OS thing I shouldn't be concerned with? The other files it couldn't find are DCOMP, GPSVC, and IESHIMS.DLL.

This builds clean with C++ importing the same DLL, so I'm not suspecting anything about my local configuration missing files. The C++ version is using a .h file with everything matching this pattern:
code:
__declspec(dllimport) int  __stdcall LIBNAME_FunctionName(char *Stringreply);
I'm seeing a few examples of using "PInvoke/MarshalAs" or something to import the C++ bindings. Is there a simple way to pull this DLL into c# or is my best bet building up the toy C++ example and some IPC to talk back to the C# app? That's possible, if a little ugly, but I'd really like to stick to pure C# if I can.

fankey
Aug 31, 2001

Bognar posted:

EDIT: I should probably ask, what are you trying to do? This may not be the best way of going about things.
It's CAD-like software where I have a z-ordered collection of graphic ( Visual ) objects. Some of these objects are 'layers' ( Canvas, which is also a Visual ) which have their own list of z-ordered ( relative to the layer ) list of objects. I want to enumerate all objects sorted by z-order. Your suggestion seems to work pretty well - at least in my limited testing so far. Thanks.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
How many methods are you calling on the DLL? The way I normally go about dealing with unmanaged code and things like this is to just use P/Invoke, which could be useful if you're not using that many methods. Here's a sample from my Cairo wrapper:

C# code:
internal class Native
{
	const string CairoDll = "libcairo-2.dll";

	[DllImport(CairoDll, CallingConvention = CallingConvention.Cdecl)]
	public static extern IntPtr cairo_win32_surface_create(IntPtr hdc);

	[DllImport(CairoDll, CallingConvention = CallingConvention.Cdecl)]
	public static extern void cairo_surface_destroy(IntPtr surface);

	[DllImport(CairoDll, CallingConvention = CallingConvention.Cdecl)]
	public static extern IntPtr cairo_surface_finish(IntPtr surface);

	[DllImport(CairoDll, CallingConvention = CallingConvention.Cdecl)]
	public static extern void cairo_surface_show_page(IntPtr surface);
	
	...
}

raminasi
Jan 25, 2005

a last drink with no ice

JawnV6 posted:

I have a reference application in C++ that uses a DLL for a USB device. It needs to integrate with a C# app I'm already building. I wanted to just import the DLL into C#, but I'm hitting errors I haven't seen before and hit my limits on google/SO.

When I try to grab the DLLthrough Reference Manager, the error pops up as "A reference to "dll_name.dll" could not be added. Please make sure the file is accessible, and that it is a valid assembly or COM component." This led me to a SO answer suggesting TlbImp.exe, which gives me
Now I'm neck deep in Dependency Walker and seeing a lot of API-MS-WIN-CORE-*, which seems to be a legacy OS thing I shouldn't be concerned with? The other files it couldn't find are DCOMP, GPSVC, and IESHIMS.DLL.

This builds clean with C++ importing the same DLL, so I'm not suspecting anything about my local configuration missing files. The C++ version is using a .h file with everything matching this pattern:
code:
__declspec(dllimport) int  __stdcall LIBNAME_FunctionName(char *Stringreply);
I'm seeing a few examples of using "PInvoke/MarshalAs" or something to import the C++ bindings. Is there a simple way to pull this DLL into c# or is my best bet building up the toy C++ example and some IPC to talk back to the C# app? That's possible, if a little ugly, but I'd really like to stick to pure C# if I can.

Those "References" are for other managed assemblies, not native code. Just P/Invoke into the .dll as Bognar said. (Make sure your import declarations use CallingConvention.StdCall instead of CallingConvention.Cdecl, though.)

JawnV6
Jul 4, 2004

So hot ...

Bognar posted:

How many methods are you calling on the DLL? The way I normally go about dealing with unmanaged code and things like this is to just use P/Invoke, which could be useful if you're not using that many methods. Here's a sample from my Cairo wrapper:
<snip>

Less than 20. All string based, there's a bunch of magic numbers that get shuffled around as ASCII strings. I'll give this a shot, thanks!

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

JawnV6 posted:

Less than 20. All string based, there's a bunch of magic numbers that get shuffled around as ASCII strings. I'll give this a shot, thanks!

https://msdn.microsoft.com/en-us/magazine/cc164123.aspx

This is a pretty good reference for P/Invoke. You may be interested in the sections titled "Marshaling Text" and "CharSet".

JawnV6
Jul 4, 2004

So hot ...

Bognar posted:

https://msdn.microsoft.com/en-us/magazine/cc164123.aspx

This is a pretty good reference for P/Invoke. You may be interested in the sections titled "Marshaling Text" and "CharSet".

Thanks, this has made me marginally more dangerous. I got over the StackImbalance errors and I'm seeing the same results for integer return type as the C++ program. Now I'm trying to get strings back out of this board and I'm having AccessViolations, time to read this Marshaling Text section in depth!

Cheers!

e: whatever a StringBuilder is it's working

JawnV6 fucked around with this message at 02:21 on Feb 25, 2015

Centripetal Horse
Nov 22, 2009

Fuck money, get GBS

This could have bought you a half a tank of gas, lmfao -
Love, gromdul

GrumpyDoctor posted:

This is really hard to diagnose without code.

Yeah, sorry. It turns out the object in question is a bit notorious for this behavior. I tried cloning/freezing it, but that led to another set of problems. In the end, I went with the ghetto solution of creating another class which I load with everything I need from the Bitmap-derived object. Using this method, everything works as I expect it to, including accessing things in other threads using Dispatcher.Invoke().

I'm sure I'm the real problem, here, and I feel like my solution is not very elegant, but it works.

Thanks to everyone who replied.

chippy
Aug 16, 2006

OK I DON'T GET IT
In WinForms, if I've got a ListBox showing a list of entities, and I want to update this listbox with a fresh list I just pulled out of the database, what's the 'best practice' way of doing this?

More specifically, I want to maintain the selection. If an item is selected in the list and is still in the list after the update, it should remain selected. It it's removed I guess the selection should jump back to the first in the list, or maybe the previous.

Just changing the DataSource property to the new collection will reset the selected item as well. I'm guess I should be using a BindingSource or something like that?

chippy fucked around with this message at 14:35 on Feb 25, 2015

Ochowie
Nov 9, 2007

This might be a dumb question but what's the intended deployment scenario with ASP.NET 5.0 (previously vNext)? The documentation states that it can be self hosted or hosted in IIS. So that leaves me wondering if the intended Mac and Linux deployment scenario is really supposed to be the self hosting approach. I always thought this sort of thing was for development and debugging only (kind of like Flask self-hosting) and that production should go through Apache or NGinx or something.

raminasi
Jan 25, 2005

a last drink with no ice
I've got a desktop application that runs through a loop in which each loop iteration creates a directory, uses it for some scratch work, and then deletes it. On some loop iterations the call to Directory.CreateDirectory fails with an UnauthorizedAccessException, but this makes no sense to me, because the directory name doesn't change, and nothing else uses it. (I know that nothing uses it because it's a temp directory.) What could be going on here?

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug

GrumpyDoctor posted:

I've got a desktop application that runs through a loop in which each loop iteration creates a directory, uses it for some scratch work, and then deletes it. On some loop iterations the call to Directory.CreateDirectory fails with an UnauthorizedAccessException, but this makes no sense to me, because the directory name doesn't change, and nothing else uses it. (I know that nothing uses it because it's a temp directory.) What could be going on here?

Can you post some code? Could be a logic error in the code. If it's a transient error you could use something like Polly to retry.

EDIT: Anyone here use OzCode? I'm wondering if it's worth the cash

Blasphemeral
Jul 26, 2012

Three mongrel men in exchange for a party member? I found that one in the Faustian Bargain Bin.

GrumpyDoctor posted:

I've got a desktop application that runs through a loop in which each loop iteration creates a directory, uses it for some scratch work, and then deletes it. On some loop iterations the call to Directory.CreateDirectory fails with an UnauthorizedAccessException, but this makes no sense to me, because the directory name doesn't change, and nothing else uses it. (I know that nothing uses it because it's a temp directory.) What could be going on here?

Are you running a virus scan program? I've noticed that virus scans sometimes sweep new directories, preventing them from being deleted/recreated.

raminasi
Jan 25, 2005

a last drink with no ice

gariig posted:

Can you post some code? Could be a logic error in the code. If it's a transient error you could use something like Polly to retry.

EDIT: Anyone here use OzCode? I'm wondering if it's worth the cash

C# code:
try { Directory.Delete(settings.WorkDir, true); }
catch (IOException) { /* scratch directory, failure to delete doesn't really matter */ }
Directory.CreateDirectory(Path.Combine(settings.WorkDir, settings.ProjectName));
If the prior deletion fails it isn't a big deal, and I know that in the cases that the call to CreateDirectory fails, the deletion is succeeding anyway.

Blasphemeral posted:

Are you running a virus scan program? I've noticed that virus scans sometimes sweep new directories, preventing them from being deleted/recreated.

I do have AV, so I guess this could be the problem. Maybe I should add a little wait beforehand?

JawnV6
Jul 4, 2004

So hot ...
Try adding some nonce to the directory name (temp_1, temp_2, etc.)? At the very least would help isolate if it's because of the proximity of the delete/create and someone holding onto it.

Gul Banana
Nov 28, 2003

Ochowie posted:

This might be a dumb question but what's the intended deployment scenario with ASP.NET 5.0 (previously vNext)? The documentation states that it can be self hosted or hosted in IIS. So that leaves me wondering if the intended Mac and Linux deployment scenario is really supposed to be the self hosting approach. I always thought this sort of thing was for development and debugging only (kind of like Flask self-hosting) and that production should go through Apache or NGinx or something.

they're writing a libuv-based http server named Kestrel
put it behind nginx and it's no worse than how people host a lot of random stuff

raminasi
Jan 25, 2005

a last drink with no ice

JawnV6 posted:

Try adding some nonce to the directory name (temp_1, temp_2, etc.)? At the very least would help isolate if it's because of the proximity of the delete/create and someone holding onto it.

This didn't help. Neither did sleeping for a full second between directory deletion and creation, so I really have no idea what the gently caress.

RangerAce
Feb 25, 2014

Ochowie posted:

This might be a dumb question but what's the intended deployment scenario with ASP.NET 5.0 (previously vNext)? The documentation states that it can be self hosted or hosted in IIS. So that leaves me wondering if the intended Mac and Linux deployment scenario is really supposed to be the self hosting approach. I always thought this sort of thing was for development and debugging only (kind of like Flask self-hosting) and that production should go through Apache or NGinx or something.

Is "self-hosted" a euphemism for "hosted on OWIN"?

ljw1004
Jan 18, 2005

rum

GrumpyDoctor posted:

This didn't help. Neither did sleeping for a full second between directory deletion and creation, so I really have no idea what the gently caress.

That still sounds like AV. I've had so much trouble with AV holding onto things. I don't think "a full second" is a very long time in the horrible world of AV file locking.

JawnV6
Jul 4, 2004

So hot ...

ljw1004 posted:

That still sounds like AV.

But it wouldn't be holding the same thing? I'm worried that I'm speaking to a leaky abstraction, but Grumpy's saying that this sequence:
code:
Create("temp1");
Delete("temp1");
Create("temp2");
threw an exception trying to create temp2?

crashdome
Jun 28, 2011
Are you creating new directories for scratch data and then dumping them all within a second? That seems awfully awful.

chippy posted:

In WinForms, if I've got a ListBox showing a list of entities, and I want to update this listbox with a fresh list I just pulled out of the database, what's the 'best practice' way of doing this?

More specifically, I want to maintain the selection. If an item is selected in the list and is still in the list after the update, it should remain selected. It it's removed I guess the selection should jump back to the first in the list, or maybe the previous.

Just changing the DataSource property to the new collection will reset the selected item as well. I'm guess I should be using a BindingSource or something like that?

From my horrible WinForms memory:
You'll have to store a key or some way to lookup the object in the new datasource, find the index, and reset the selected index if you choose to change the datasource. - This is the fastest for large lists but the change in datasource may cause UI flickering or some other weird behavior if you hold object references.
The alternative is to have a single datasource that you add or remove items by comparing your refreshed data with the existing data.

Either way you go, if the list is small (say <1000 items), you wont see any performance problems. Although, I recommend keeping a single datasource and updating it yourself manually if it is only ever "read only" list. You can use the datasource methods to perform lookups and object comparisons. For example, with a single datasource, you can grab a reference to the selected object prior to refresh, see if it exists in the datasource when refreshed and if not, just set selected index to 0 (assuming there is always at least one item) and leave well enough alone. Its pretty simple too...

[*]Clone your datasource as a new list of "To be deleted" and make an empty "to be added" list
[*]Traverse the refresh list, compare items, and remove existing items from the "delete list" while also adding new items to the "to be added" list
[*]Remove and add each list as a range from your datasource

This has, for me, been the most effective and smooth way to do it and keep the UI responsive.

raminasi
Jan 25, 2005

a last drink with no ice

JawnV6 posted:

But it wouldn't be holding the same thing? I'm worried that I'm speaking to a leaky abstraction, but Grumpy's saying that this sequence:
code:
Create("temp1");
Delete("temp1");
Create("temp2");
threw an exception trying to create temp2?

That's not even the sequence; it's just
code:
Delete("temp")
Create("temp")
and the exception is thrown by the Create().

crashdome posted:

Are you creating new directories for scratch data and then dumping them all within a second? That seems awfully awful.

No; the way each run works it that it verifies that its scratch directory is empty before beginning by just blowing it away and recreating it. But apparently recreating it causing me problems.

It turns out that sleeping for a bit before recreating the scratch directory does actually solve the problem, so I'm willing to chalk this up to some weird filesystem nonsense even if it's not AV.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

GrumpyDoctor posted:

No; the way each run works it that it verifies that its scratch directory is empty before beginning by just blowing it away and recreating it. But apparently recreating it causing me problems.

It turns out that sleeping for a bit before recreating the scratch directory does actually solve the problem, so I'm willing to chalk this up to some weird filesystem nonsense even if it's not AV.

I'd be very hesitant to rely on non-deterministic behavior. How do you know that the sleep call is long enough for any target machine? Or even that it's long enough for your machine all the time? I think the nonce is a much better way of going about it.

Ochowie
Nov 9, 2007

RangerAce posted:

Is "self-hosted" a euphemism for "hosted on OWIN"?

I guess. They didn't call OWIN out by name but I guess that's what it would be.


Gul Banana posted:

they're writing a libuv-based http server named Kestrel
put it behind nginx and it's no worse than how people host a lot of random stuff

Interesting. I'll dig around for that.

JawnV6
Jul 4, 2004

So hot ...

GrumpyDoctor posted:

That's not even the sequence; it's just
code:
Delete("temp")
Create("temp")
and the exception is thrown by the Create().
Oh, my suggestion was to add the 1 & 2 after, I understood your post that ljw quoted to be implementing that.. Just to decouple the delete/create, even with only "tempa" and "tempb" you could toggle which temp dir is in use by the current iteration and give that much more time to whatever FS goofiness is happening.

raminasi
Jan 25, 2005

a last drink with no ice

Bognar posted:

I'd be very hesitant to rely on non-deterministic behavior. How do you know that the sleep call is long enough for any target machine? Or even that it's long enough for your machine all the time? I think the nonce is a much better way of going about it.

The target machine is my desktop, and it only needs to run once so I can get the outputs. C# happens to be the best "scripting language" for the job for unimportant reasons.

EssOEss
Oct 23, 2006
128-bit approved
Process Monitor should be able to show you what exactly keeps the directory locked. Maybe.

chippy
Aug 16, 2006

OK I DON'T GET IT

crashdome posted:


From my horrible WinForms memory:
You'll have to store a key or some way to lookup the object in the new datasource, find the index, and reset the selected index if you choose to change the datasource. - This is the fastest for large lists but the change in datasource may cause UI flickering or some other weird behavior if you hold object references.
The alternative is to have a single datasource that you add or remove items by comparing your refreshed data with the existing data.

Either way you go, if the list is small (say <1000 items), you wont see any performance problems. Although, I recommend keeping a single datasource and updating it yourself manually if it is only ever "read only" list. You can use the datasource methods to perform lookups and object comparisons. For example, with a single datasource, you can grab a reference to the selected object prior to refresh, see if it exists in the datasource when refreshed and if not, just set selected index to 0 (assuming there is always at least one item) and leave well enough alone. Its pretty simple too...

[*]Clone your datasource as a new list of "To be deleted" and make an empty "to be added" list
[*]Traverse the refresh list, compare items, and remove existing items from the "delete list" while also adding new items to the "to be added" list
[*]Remove and add each list as a range from your datasource

This has, for me, been the most effective and smooth way to do it and keep the UI responsive.

Thanks for this. When I used the List as the datasource for the ListBox directly, it didn't seem to update the display of the listbox as I added and removed items. I ended up creating a BindingSource with the list as its datasource, and then using that as the datasource for the listbox. Once I did it that way, it kept up with any items added or removed, and also took care of maintaining the selection automatically.

Adbot
ADBOT LOVES YOU

bpower
Feb 19, 2011
Hi Guys,

I have an web api controller that updates a transaction record. If the transaction type is changed I want to update all other transactions of the same type (based on the transaction description). How do i pass back the list of "other transaction updated in the back ground" in the HttpResponseMessage ?

Im probably going about this completely wrong. I just started playing around with WebApi. My controller was created using the ApiControllerWithContextScaffolder.
2
code:
        public HttpResponseMessage Put(int id, Transaction trans)
        {
            Console.WriteLine("Id: " + id + " value: " + trans.Description);

            if (id != trans.TransactionId)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
            
            // update other transactions based on the transaction description and some other stuff
            var updatedtransactions = _allocationLogicService.CarryForwardAllocationRule(trans);
            // updatedtransactions is a List<Transaction>

            try
            {
                _db.Entry(trans).State = EntityState.Modified;
                _db.SaveChanges();
            }
            catch (Exception ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }
            // How do I pass list oif transaction back to client?
            return Request.CreateResponse(HttpStatusCode.OK);

        }

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply