How to use await with EditableRoot.Save()

How to use await with EditableRoot.Save()

Old forum URL: forums.lhotka.net/forums/t/12878.aspx


pecen posted on Thursday, May 07, 2015

I have an Mvc 4 webapp where in one of the controllers I somehow want to use the following function:

 

 

 

 

 

[

 

Authorize(Roles = "Administrators")]

 

 

public async Task<ActionResult> SaveProduct(ProductEdit product)

{

product =

 

await product.Save();

 

 

return RedirectToAction("Index");

}

Is there a way to make an EditableRoot.Save() to work with async/await?

Thanks,

Peter

JonnyBee replied on Thursday, May 07, 2015

use 

product = await product.SaveAsync();

 

pecen replied on Friday, May 08, 2015

Thanks a lot!!

For some reason I totally missed that you've added SaveAsync().

Copyright (c) Marimer LLC