예제 #1
0
        public ActionResult Add(SalePoint newentry)
        {
            if (ModelState.IsValid)
            {
                var salepoint = AgroExpressDBAccess.IsSalePointExist(newentry.SalePointName);

                if (salepoint != null)
                {
                    ModelState.AddModelError("SalePointName", "Sale Point already exist");
                    return(View(newentry));
                }

                var salepointt = new SalePoint();
                salepointt.SalePointName    = newentry.SalePointName;
                salepointt.SalePointAddress = newentry.SalePointAddress;
                salepointt.IsDeleted        = false;

                if (AgroExpressDBAccess.AddSalePoint(salepointt))
                {
                    ViewBag.success = "Sale Point Add Successsfull";
                    ModelState.Clear();
                    SalePoint registration = new SalePoint();
                    return(View(registration));
                }
            }
            return(View(newentry));
        }