/// <summary> /// Adding new Population Registartion to db /// </summary> /// <param name="newPopulationRegistration"></param> /// <returns>whether operation was successfull or not</returns> public bool Add(PopulationRegistration newPopulationRegistration) { try { collectionContext.PopulationRegistrations.Add(newPopulationRegistration); collectionContext.SaveChanges(); return(true); } catch { return(false); } }
/// <summary> /// Adding House Data To db /// </summary> /// <param name="houseListing"></param> /// <returns>whethe data was successfully entred or not</returns> public HouseListing AddHouseData(HouseListing houseData) { try { collectionContext.HouseListings.Add(houseData); collectionContext.SaveChanges(); return(houseData); } catch { return(null); } }
/// <summary> /// Adding new user to db /// </summary> /// <param name="createNewUser"></param> /// <returns>whether user was added to db or not</returns> public bool CreateUser(User createNewUser) { int ifExist = (from existingUser in collectionContext.Users where existingUser.EmailId == createNewUser.EmailId select existingUser).Count(); if (ifExist == 0) //making sure that this is not entered before { collectionContext.Users.Add(createNewUser); collectionContext.SaveChanges(); UserRequestStatusRepository userRequestStatusRepository = new UserRequestStatusRepository(); userRequestStatusRepository.CreateUserRequest(createNewUser.UserId); return(true); } return(false); }
/// <summary> /// Addingg User Request to db /// </summary> /// <param name="userId"></param> /// <returns> whether request added to db or not</returns> public bool CreateUserRequest(int userId) { try { UserRequestStatus userRequestStatus = new UserRequestStatus(); userRequestStatus.UserId = userId; userRequestStatus.RequestStatus = Status.Pending; collectionContext.UserRequestStatus.Add(userRequestStatus); collectionContext.SaveChanges(); return(true); } catch { return(false); } }