Example #1
0
 public static DAL.Shelter DtoToDAL(ShelterDTO shelterDTO)
 {
     DAL.Shelter shelterDAL = new DAL.Shelter();
     shelterDAL.ShelterKey         = shelterDTO.ShelterKey;
     shelterDAL.LatShelter         = shelterDTO.LatShelter;
     shelterDAL.LngShelter         = shelterDTO.LngShelter;
     shelterDAL.MaxPeople          = shelterDTO.MaxPeople;
     shelterDAL.ShelterDescription = shelterDTO.ShelterDescription;
     return(shelterDAL);
 }
Example #2
0
 public static DAL.Shelter DtoToDAL(ShelterDTO shelterDTO)
 {
     DAL.Shelter shelterDAL = new DAL.Shelter();
     shelterDAL.ShelterKey         = shelterDTO.ShelterKey;
     shelterDAL.City               = shelterDTO.City;
     shelterDAL.ShelterStreet      = shelterDTO.ShelterStreet;
     shelterDAL.StreetNumber       = shelterDTO.StreetNumber;
     shelterDAL.MaxPeople          = shelterDTO.MaxPeople;
     shelterDAL.ShelterDescription = shelterDTO.ShelterDescription;
     return(shelterDAL);
 }
Example #3
0
 public static ShelterDTO AddNewShelter(ShelterDTO newShelter, ref string message)
 {
     DAL.Shelter ifLatExists = db.Shelters.FirstOrDefault(s => s.LatShelter == newShelter.LatShelter);
     DAL.Shelter ifLngExists = db.Shelters.FirstOrDefault(s => s.LngShelter == newShelter.LngShelter);
     if (ifLatExists != null && ifLngExists != null)
     {
         message = "מקלט זה קיים במערכת";
         return(null);
     }
     DAL.Shelter shelterDAL = DtoToDAL(newShelter);
     db.Shelters.Add(shelterDAL);
     db.SaveChanges();
     return(newShelter);
 }