Exemple #1
0
        public ActionResult Edit(Bay model)
        {
            model.OrganizationId = OrganizationId;
            model.CreatedDate    = System.DateTime.Now;
            model.CreatedBy      = UserID.ToString();

            var  repo     = new BayRepository();
            bool isexists = repo.IsFieldExists(repo.ConnectionString(), "Bay", "BayName", model.BayName, "BayId", model.BayId);

            if (!isexists)
            {
                var result = new BayRepository().UpdateBay(model);
                if (result.BayId > 0)
                {
                    TempData["Success"]  = "Updated Successfully!";
                    TempData["BayRefNo"] = result.BayRefNo;
                    return(RedirectToAction("Create"));
                }

                else
                {
                    FillBayType();
                    TempData["error"]    = "Oops!!..Something Went Wrong!!";
                    TempData["BayRefNo"] = null;
                    return(View("Create", model));
                }
            }
            else
            {
                FillBayType();
                TempData["error"]    = "This Name Alredy Exists!!";
                TempData["BayRefNo"] = null;
                return(View("Create", model));
            }
        }
Exemple #2
0
        public ActionResult Delete(Bay model)
        {
            int result = new BayRepository().DeleteBay(model);

            if (result == 0)
            {
                TempData["Success"]  = "Deleted Successfully!";
                TempData["BayRefNo"] = model.BayRefNo;
                return(RedirectToAction("Create"));
            }
            else
            {
                if (result == 1)
                {
                    FillBayType();
                    TempData["error"]    = "Sorry!! You Cannot Delete This Bay It Is Already In Use";
                    TempData["BayRefNo"] = null;
                }
                else
                {
                    FillBayType();
                    TempData["error"]    = "Oops!!..Something Went Wrong!!";
                    TempData["BayRefNo"] = null;
                }
                return(RedirectToAction("Create"));
            }
        }
Exemple #3
0
        public ActionResult Edit(int Id)
        {
            FillBayType();
            ViewBag.Title = "Edit";
            Bay objBay = new BayRepository().GetBay(Id);

            return(View("Create", objBay));
        }
Exemple #4
0
        public ActionResult FillBayList(int?page)
        {
            int itemsPerPage = 10;
            int pageNumber   = page ?? 1;
            var rep          = new BayRepository();
            var List         = rep.GetBays();

            return(PartialView("BayListView", List));
        }