-2
    public async Task<JsonResult> Save(List<SalesNewItemModel> aSalesNewItemModel)
    {
        string msg =  await _aSalesNewItemManager.Save(aSalesNewItemModel);
        return Json(msg, JsonRequestBehavior.AllowGet);
    }

Shows Error type string is not awaitable

Rakib
  • 21
  • 5
  • You can not apply async await to every thing. Return type of _aSalesNewItemManager.Save(aSalesNewItemModel) must be a task. – Khalil Oct 24 '17 at 05:43
  • Can u please retype my function – Rakib Oct 24 '17 at 05:47
  • I need this method to provide any help _aSalesNewItemManager.Save(aSalesNewItemModel) – Khalil Oct 24 '17 at 05:52
  • [async await docs](https://learn.microsoft.com/en-us/dotnet/csharp/async) ..[Relevant Stack question](https://stackoverflow.com/questions/14455293/how-and-when-to-use-async-and-await) – Khalil Oct 24 '17 at 05:53

1 Answers1

0

Since the method doesn't call anything async, just make it non-async.

public JsonResult Save(List<SalesNewItemModel> aSalesNewItemModel)
{
    string msg = _aSalesNewItemManager.Save(aSalesNewItemModel);
    return Json(msg, JsonRequestBehavior.AllowGet);
}

Or you should change _aSalesNewItemManager.Save to return Task<string> and make use of asynchronous processing in that method. For example async IO.

Allrameest
  • 4,364
  • 2
  • 34
  • 50