public static void AddPolicestation(this tbl_policestation policestation, PoliceStationViewModel policestationVm) { policestation.tenant_id = policestationVm.tenant_id; policestation.project_id = policestationVm.project_id; policestation.ps_name = policestationVm.ps_name; policestation.ps_contact_person = policestationVm.ps_contact_person; policestation.contact_person_mobile_no = policestationVm.contact_person_mobile_no; policestation.created_date = DateTime.Now; policestation.created_by = policestationVm.created_by; policestation.modified_date = DateTime.Now; policestation.modified_by = policestationVm.modified_by; }
public HttpResponseMessage SavePoliceStation(HttpRequestMessage request, PoliceStationViewModel policestation) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (!ModelState.IsValid) { response = request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } else { tbl_policestation newPolicestation = new tbl_policestation(); newPolicestation.AddPolicestation(policestation); _policestationRepository.Add(newPolicestation); _unitOfWork.Commit(); response = request.CreateResponse <PoliceStationViewModel>(HttpStatusCode.Created, policestation); } return response; })); }