public static void addFieldWorkForm(this tbl_fieldwork_price Fieldwork, FieldworkViewModel FieldworkVM) { Fieldwork.tenant_id = FieldworkVM.tenant_id; Fieldwork.project_id = FieldworkVM.project_id; Fieldwork.fieldwork_name = FieldworkVM.fieldwork_name; Fieldwork.fieldwork_description = FieldworkVM.fieldwork_description; Fieldwork.fieldwork_price = FieldworkVM.fieldwork_price; Fieldwork.unit_of_measurement = FieldworkVM.unit_of_measurement; }
public HttpResponseMessage SaveFieldWorkPrice(HttpRequestMessage request, FieldworkViewModel fieldworkprice) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (!ModelState.IsValid) { response = request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } else { tbl_fieldwork_price newFieldWorkPrice = new tbl_fieldwork_price(); newFieldWorkPrice.addFieldWorkForm(fieldworkprice); _FieldWorkPriceRepository.Add(newFieldWorkPrice); _unitOfWork.Commit(); response = request.CreateResponse <FieldworkViewModel>(HttpStatusCode.Created, fieldworkprice); } return response; })); }