コード例 #1
0
        public ActionResult Create(FloorViewModel model)
        {
            try
            {
                bool result = _floorService.AddFloor(model);

                if (result)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                throw new Exception();
            }
            catch
            {
                ModelState.AddModelError(string.Empty, "Ooops! Something went wrong!");
                return(View());
            }
        }
コード例 #2
0
        public string SaveFloor(FloorModel floor)
        {
            Mapper.CreateMap <FloorModel, Floor>();
            Floor fl = Mapper.Map <FloorModel, Floor>(floor);

            fl.CrBy   = User.Identity.Name;
            fl.CrDate = DateTime.Now;
            bool bl = flrService.IsFloorNo(floor.FloorNo, floor.TowerID);

            if (bl == true)
            {
                return((2).ToString());
            }
            else
            {
                int i = flrService.AddFloor(fl);
                return(i.ToString());
            }
        }