Exemplo n.º 1
0
        public ActionResult Add(Core.Domain.Building model)
        {
            string ErrorMsg = "";

            _IBuildingService = new BuildingService();
            //   if (ModelState.IsValid == true) // Server side validation
            //  {
            int ID = _IBuildingService.InsertBuilding(model, ref ErrorMsg);

            if (ErrorMsg != "")
            {
                if (TempData["ErrorMsg"] == null)
                {
                    TempData["ErrorMsg"] = ErrorMsg;
                }
            }
            else if (ID > 0)
            {
                if (TempData["ErrorMsg"] == null)
                {
                    TempData["ErrorMsg"] = model.BuildingName + "  Added Successfully";
                }
            }
            return(RedirectToAction("List"));
            //  }
        }
Exemplo n.º 2
0
        public ActionResult List()
        {
            _IBuildingService = new BuildingService();
            var obj = _IBuildingService.GetListView();

            if (TempData["ErrorMsg"] != null)
            {
                string msg = Convert.ToString(TempData["ErrorMsg"]);
                ModelState.AddModelError("ErrorMsg", msg);
            }

            return(View(obj));
        }