public async Task <IResponseModel> AddRoomFeatureAsync(IRoomFeaturesModel model) { try { var features = new RoomFeatures { Id = Guid.NewGuid(), Name = model.Name, RoomId = model.RoomId }; _db.RoomFeatures.Add(features); await _db.SaveChangesAsync(); _response.Status = true; _response.Message = "Room feature added."; return(_response); } catch (Exception ex) { _loggerService.Log("Add Room Feature", ex.InnerException.Message, ex.Message, ex.StackTrace); _response.Status = false; _response.Message = "An error occurred while adding room feature."; return(_response); } }
public ActionResult RoomFeaturesDelete(int id) { RoomFeatures room = _serviceRoomFeatures.GetById(id); room.IsActive = false; _serviceRoomFeatures.Update(room); return(RedirectToAction("RoomFeaturesList")); }
public ActionResult RoomFeaturesEdit(RoomFeaturesModel roomFeatures) { RoomFeatures roomfeatures = roomFeatures.ModelToEnity(); roomfeatures.IsActive = true; _serviceRoomFeatures.Update(roomfeatures); return(RedirectToAction("RoomFeaturesList")); }
public ActionResult RoomFeatureInsert(RoomFeaturesModel roomModel) { RoomFeatures room = roomModel.ModelToEnity(); room.IsActive = true; _serviceRoomFeatures.Insert(room); return(RedirectToAction("RoomFeaturesList")); }
public static RoomFeatures ModelToEnity(this RoomFeaturesModel model, bool virtualActive = false) { RoomFeatures entity = new RoomFeatures() { Name=model.Name, Id = model.Id, IsActive = model.IsActive }; if (virtualActive) { entity.RoomFeaturesRoomTypes = model.RoomFeaturesRoomTypes; } return entity; }
public static RoomFeatures ModelToEnity(this RoomFeaturesModel model, bool virtualActive = false) { RoomFeatures entity = new RoomFeatures() { Name = model.Name, Id = model.Id, IsActive = model.IsActive }; if (virtualActive) { entity.RoomFeaturesRoomTypes = model.RoomFeaturesRoomTypes; } return(entity); }
public static RoomFeature Get(RoomFeatures feature) { switch (feature){ case RoomFeatures.Internet: return new RoomFeature("Internet Connection", "This snazzy internet connection will load your google in record times!"); case RoomFeatures.TV: return new RoomFeature("TV", "Never miss an episode of corrie again with this moving picture box (Also available in 4k HD)"); case RoomFeatures.Minibar: return new RoomFeature("Mini-bar", "Yes, we said mini. Enjoy your thimble."); default: throw new IndexOutOfRangeException("Not a real feature"); } }
public static RoomFeature Get(RoomFeatures feature) { switch (feature) { case RoomFeatures.Internet: return(new RoomFeature("Internet Connection", "This snazzy internet connection will load your google in record times!")); case RoomFeatures.TV: return(new RoomFeature("TV", "Never miss an episode of corrie again with this moving picture box (Also available in 4k HD)")); case RoomFeatures.Minibar: return(new RoomFeature("Mini-bar", "Yes, we said mini. Enjoy your thimble.")); default: throw new IndexOutOfRangeException("Not a real feature"); } }
public static RoomFeaturesModel EntityToModel(this RoomFeatures entity, bool virtualActive = false) { try { RoomFeaturesModel model = new RoomFeaturesModel() { Name = entity.Name, IsActive = entity.IsActive, Id = entity.Id }; if (virtualActive) { model.RoomFeaturesRoomTypes = entity.RoomFeaturesRoomTypes; } return(model); } catch (Exception) { return(new RoomFeaturesModel()); } }