Remove inventory, delete transactions
This commit is contained in:
@@ -12,7 +12,7 @@ namespace InventoryTraker.Web.Controllers
|
||||
return new BetterJsonResult<T> {Data = model};
|
||||
}
|
||||
|
||||
protected IEnumerable<string> GetModelStateErrorList()
|
||||
protected string[] GetModelStateErrorList()
|
||||
{
|
||||
var errorList =
|
||||
from kvp in ModelState
|
||||
@@ -20,13 +20,18 @@ namespace InventoryTraker.Web.Controllers
|
||||
let errors = string.Join(", ", kvp.Value.Errors.Select(e => e.ErrorMessage))
|
||||
let msg = kvp.Key + ": " + errors
|
||||
select msg;
|
||||
return errorList;
|
||||
return errorList.ToArray();
|
||||
}
|
||||
|
||||
protected JsonResult GetModelStateErrorListJson()
|
||||
{
|
||||
return GetErrorListJson(GetModelStateErrorList());
|
||||
}
|
||||
|
||||
protected JsonResult GetErrorListJson(params string[] errors)
|
||||
{
|
||||
var betterJsonResult = new BetterJsonResult();
|
||||
foreach (var err in GetModelStateErrorList())
|
||||
foreach (var err in errors)
|
||||
betterJsonResult.AddError(err);
|
||||
return betterJsonResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user