public IActionResult Create(Room room)
 {
     if (ModelState.IsValid)
     {
         bool isSaved = _roomManager.Add(room);
         if (isSaved)
         {
             ViewBag.Message = "Saved Successfully..";
         }
     }
     return(View());
 }
Esempio n. 2
0
        public ActionResult Create(RoomViewModel model)
        {
            model.RoomTypeList = _roomTypeManager.GetAll().Where(n => n.Active);
            model.FloorList    = _floorManager.GetAll().Where(n => n.Active);

            if (ModelState.IsValid)
            {
                if (_roomManager.CheckDuplicate(model))
                {
                    ViewBag.DuplicateError = "Room Already Exists!!";
                    return(View(model));
                }
                else
                {
                    _roomManager.Add(model);
                    return(RedirectToAction("Index"));
                }
            }
            return(View(model));
        }
        public async Task <ActionResult> Create(Room room)
        {
            await Manager.Add(room);

            return(RedirectToAction(nameof(ShowRoom)));
        }
Esempio n. 4
0
 public async Task <DataResult> Post([FromBody] Room model)
 {
     return(await _roomManager.Add(model));
 }