public Company_Service_LocationDto CreateCompany_Service_Location(Company_Service_LocationDto a) { if (!ModelState.IsValid) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var abc = Mapper.Map <Company_Service_LocationDto, Company_Service_Location>(a); context.Company_Service_Location.Add(abc); context.SaveChanges(); return(a); }
public void UpdateCompany_Service_Location(int id, Company_Service_LocationDto company_Service_LocationDto) { if (!ModelState.IsValid) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var admin = context.Company_Service_Location.SingleOrDefault(c => c.Company_Service_Location_Id == id); if (admin == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } Mapper.Map(company_Service_LocationDto, admin); context.SaveChanges(); }