public bool Post([FromBody] SalesOrderCommonEntity SalesOrderCommonEntity) { try { return(_SalesOrderService.Create(SalesOrderCommonEntity)); } catch (Exception ex) { throw new ApiDataException(1000, "Category Not Found", HttpStatusCode.NotFound); } }
public IActionResult Create([FromBody] SaleOrderDTO salesorderDTO) { SalesOrder SalesOrder = new SalesOrder(); SalesOrder.EnterpriseName = salesorderDTO.EnterpriseName; //productType.CreatedBy = User.Identity.Name; var saleorderEntity = _salesorderService.Create(SalesOrder); var sales = _mapper.Map <SaleOrderDTO>(saleorderEntity); return(Ok(SalesOrder)); }
protected virtual void btnSave_Click(object sender, EventArgs e) { obj.Validate(true); ErrorList valErr = obj.GetValidationErrors(); errors.List.DataSource = valErr.Errors; errors.List.DataBind(); if (valErr.HasErrors()) { return; } ISalesOrderService svcSalesOrder = DI.Resolve <ISalesOrderService>(); try { // for new objects create the object and store its key if (IsNew) { SalesOrder_CreateInput inCreate = new SalesOrder_CreateInput(); obj.ToDataContract(inCreate); SalesOrder_CreateOutput outCreate; using (TimeTracker.ServiceCall) outCreate = svcSalesOrder.Create(inCreate); obj.FromDataContract(outCreate); IsNew = false; } else { SalesOrder_UpdateInput_Data inUpdate_Data = new SalesOrder_UpdateInput_Data(); obj.ToDataContract(inUpdate_Data); using (TimeTracker.ServiceCall) svcSalesOrder.Update((int)obj.SalesOrderIdProperty.TransportValue, inUpdate_Data); } obj.SetModified(false, true); OnSaved(EventArgs.Empty); } catch (Exception ex) { errors.List.DataSource = ErrorList.FromException(ex).Errors; errors.List.DataBind(); } finally { if (svcSalesOrder is IDisposable) { ((IDisposable)svcSalesOrder).Dispose(); } } }
public async Task <bool> ProcessEachMessage() { SalesOrder.Models.SalesOrder?salesOrder = await _serviceBusHelper.GetNextOrderFromMessageQueue(); if (salesOrder == null) { return(false); } _salesOrderService.Create(salesOrder); await _serviceBusHelper.ConfirmSalesOrderToMessageQueue(salesOrder); return(true); }
public IActionResult OnPost() { try { ConvertData(SalesOrder); var insertedCount = _salesOrderService.Create(SalesOrder); } catch (Exception e) { return(GenJsonResult(-1, e.Message, 0)); } return(GenJsonResult(1, "", SalesOrder.SalesOrderID)); }
public ActionResult Create([FromBody] SalesOrder_CreateInput _data) { ActionResult response = null; try { if (ModelState.IsValid) { Output <SalesOrder_CreateOutput> output = svc.Create(_data); response = StatusCode((int)output.HttpStatus, output); return(response); } else { ModelValidation.AddModelErrors(currentErrors, ModelState); } } catch (Exception ex) { currentErrors.MergeWith(errorsParser.FromException(ex)); } response = StatusCode((int)currentErrors.HttpStatus, new Output(currentErrors)); return(response); }