public JsonResult CreateLinesSimplifiedRequisition([FromBody] SimplifiedRequisitionLineViewModel item) { UnidadeDeArmazenamento product = DBStockkeepingUnit.GetById(item.Code); SimplifiedRequisitionLineViewModel result = new SimplifiedRequisitionLineViewModel(); if (item != null) { item.CreateUser = User.Identity.Name; item.CreateDate = DateTime.Now; result = DBSimplifiedRequisitionLines.ParseToViewModel(DBSimplifiedRequisitionLines.Create(DBSimplifiedRequisitionLines.ParseToDatabase(item))); if (result != null) { result.eReasonCode = 100; result.eMessage = "Linha de Requisição Simplificada criada com sucesso."; } else { result.eReasonCode = 101; result.eMessage = "Ocorreu um erro ao criar a Requisição Simplificada."; } } return(Json(result)); }
public JsonResult CreateMultiLinesSimplifiedRequisition([FromBody] List <SimplifiedRequisitionLineViewModel> item) { List <SimplifiedRequisitionLineViewModel> result = new List <SimplifiedRequisitionLineViewModel>(); if (item != null) { item.ForEach(x => { x.CreateUser = User.Identity.Name; result.Add(DBSimplifiedRequisitionLines.ParseToViewModel(DBSimplifiedRequisitionLines.Create(DBSimplifiedRequisitionLines.ParseToDatabase(x)))); }); } return(Json(result)); }