Exemple #1
0
 public ActionResult Create(RoomTypeViewModel model)
 {
     try
     {
         // TODO: Add insert logic here
         if (!ModelState.IsValid)
         {
             return(View(model));
         }
         var roomtype  = _mapper.Map <RoomType>(model);
         var isSuccess = _repo.Create(roomtype);
         if (!isSuccess)
         {
             ModelState.AddModelError("", "Something went Wrong...");
         }
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         ModelState.AddModelError("", "Something went Wrong...");
         return(View(model));
     }
 }
 /// <summary>
 /// Method To Add/Save RoomType In RoomTypeEFRepository
 /// </summary>
 /// <param name="roomtype"></param>
 public void SaveRoomType(RoomType roomtype)
 {
     roomtypeRepository.Create(roomtype);
 }