public ActionResult Edit(string id, UncreditSaleDetailDetailView uncreditSaleDetailDetailView) { if (ModelState.IsValid) { try { EditUncreditSaleDetailRequest request = new EditUncreditSaleDetailRequest(); request.ID = Guid.Parse(id); request.ModifiedEmployeeID = GetEmployee().ID; request.Discount = uncreditSaleDetailDetailView.UncreditSaleDetailView.Discount; request.Imposition = uncreditSaleDetailDetailView.UncreditSaleDetailView.Imposition; request.LineDiscount = uncreditSaleDetailDetailView.UncreditSaleDetailView.LineDiscount; request.LineImposition = uncreditSaleDetailDetailView.UncreditSaleDetailView.LineImposition; request.LineTotal = uncreditSaleDetailDetailView.UncreditSaleDetailView.LineTotal; request.MainUncreditSaleDetailID = uncreditSaleDetailDetailView.UncreditSaleDetailView.MainUncreditSaleDetailID; request.RollbackNote = uncreditSaleDetailDetailView.UncreditSaleDetailView.RollbackNote; request.SaleID = uncreditSaleDetailDetailView.UncreditSaleDetailView.SaleID; request.UncreditServiceID = uncreditSaleDetailDetailView.UncreditSaleDetailView.UncreditServiceID; request.UnitPrice = uncreditSaleDetailDetailView.UncreditSaleDetailView.UnitPrice; request.Units = uncreditSaleDetailDetailView.UncreditSaleDetailView.Units; request.RowVersion = uncreditSaleDetailDetailView.UncreditSaleDetailView.RowVersion; EditResponse response = this._uncreditSaleDetailService.EditUncreditSaleDetail(request); if (response.Success) { return(RedirectToAction("Index")); } else { foreach (string error in response.ErrorMessages) { ModelState.AddModelError("", error); } return(View(uncreditSaleDetailDetailView)); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View(uncreditSaleDetailDetailView)); } } return(View(uncreditSaleDetailDetailView)); }
public EditResponse EditOrder(Orders order) { EditResponse response = new EditResponse(); if (_orderRepository.UpdateOrder(order)) { response.Success = true; response.Order = order; } else { response.Success = false; response.Message = "Not valid"; } return(response); }
/// <summary> /// Executes an edit request. /// </summary> public override async Task <IEditResponse> SendAsync <T>(IEditRequest <T> req) { HttpResponseMessage response = await ExecuteRequestAsync(req); if (response.IsSuccessStatusCode) { // process response data return OK var resp = new EditResponse { Messages = new List <ResponseMessage> { new ResponseMessage { Code = "", Message = "OK" } } }; return(resp); } throw new Exception("Unable to complete request"); }
public void Execute() { Console.Clear(); Console.WriteLine("Edit Orders"); Console.WriteLine(UserIO.Separator); order.dateTime = io.RemoveEditGetDate(); List <Orders> orders = orderManager.DisplayOrder(order.dateTime).Orders; order = io.EditGettingOrderNumber(orders); if (order != null) { order = io.EditOrder(order); if (order != null) { EditResponse response = orderManager.EditOrder(order); if (response.Success) { Console.Clear(); UserIO.DisplayForCustomer(response.Order); Console.ReadKey(); } } } }