예제 #1
0
        public ActionResult Delete(string id, FormCollection collection)
        {
            CreditSaleDetailDetailView creditSaleDetailDetailView = new CreditSaleDetailDetailView();

            creditSaleDetailDetailView.CreditSaleDetailView = this.GetCreditSaleDetailView(id);
            //creditSaleDetailDetailView.EmployeeView = GetEmployee();

            DeleteRequest request = new DeleteRequest()
            {
                ID = Guid.Parse(id)
            };

            DeleteResponse response = this._creditSaleDetailService.DeleteCreditSaleDetail(request);

            if (response.Success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (string error in response.ErrorMessages)
                {
                    ModelState.AddModelError("", error);
                }
                return(View(creditSaleDetailDetailView));
            }
        }
예제 #2
0
        public ActionResult Create()
        {
            CreditSaleDetailDetailView creditSaleDetailDetailView = new CreditSaleDetailDetailView();

            creditSaleDetailDetailView.EmployeeView = GetEmployee();

            return(View(creditSaleDetailDetailView));
        }
예제 #3
0
        public ActionResult Edit(string id)
        {
            CreditSaleDetailDetailView creditSaleDetailDetailView = new CreditSaleDetailDetailView();

            creditSaleDetailDetailView.CreditSaleDetailView = this.GetCreditSaleDetailView(id);
            creditSaleDetailDetailView.EmployeeView         = GetEmployee();

            return(View(creditSaleDetailDetailView));
        }
예제 #4
0
        public ActionResult Edit(string id, CreditSaleDetailDetailView creditSaleDetailDetailView)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    EditCreditSaleDetailRequest request = new EditCreditSaleDetailRequest();

                    request.ID = Guid.Parse(id);
                    request.ModifiedEmployeeID     = GetEmployee().ID;
                    request.CreditServiceID        = creditSaleDetailDetailView.CreditSaleDetailView.CreditServiceID;
                    request.Discount               = creditSaleDetailDetailView.CreditSaleDetailView.Discount;
                    request.Imposition             = creditSaleDetailDetailView.CreditSaleDetailView.Imposition;
                    request.MainCreditSaleDetailID = creditSaleDetailDetailView.CreditSaleDetailView.MainCreditSaleDetailID;
                    request.UnitPrice              = creditSaleDetailDetailView.CreditSaleDetailView.UnitPrice;
                    request.Units      = creditSaleDetailDetailView.CreditSaleDetailView.Units;
                    request.RowVersion = creditSaleDetailDetailView.CreditSaleDetailView.RowVersion;

                    EditResponse response = this._creditSaleDetailService.EditCreditSaleDetail(request);

                    if (response.Success)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        foreach (string error in response.ErrorMessages)
                        {
                            ModelState.AddModelError("", error);
                        }
                        return(View(creditSaleDetailDetailView));
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    return(View(creditSaleDetailDetailView));
                }
            }

            return(View(creditSaleDetailDetailView));
        }