protected override bool ValidatePost(System.Web.Http.ModelBinding.ModelStateDictionary validationDictionary, Client currentClient, RoomBooking entity, object param, params object[] additionalObjects) { if (!CommonValidation(validationDictionary, currentClient, entity, param, additionalObjects)) { return(false); } if (tmp != null && rtmp != null && RoomBookingRepository.FindRoomBookingForDates(entity.Room.Id, 0, entity.DateBegin == null ? (DateTime)tmp.DateArrival : (DateTime)entity.DateBegin, entity.DateEnd == null ? (DateTime)tmp.DateDeparture : (DateTime)entity.DateEnd, currentClient.Id) != null) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <RoomBooking>(), "RoomId"), GenericError.ALREADY_EXISTS); } return(validationDictionary.IsValid); }
public void Init() { ctx = EFContext.CreateContext(); repo = new RoomBookingRepository(ctx); }
public HomeController() { db = new RoomBookingRepository(); }