public static void AddratechartItems(this tbl_subcontractor_ratechart ratechart, RateChartItems ratechartItemsVm) { ratechart.fieldwork_id = ratechartItemsVm.fieldwork_id; ratechart.fieldwork_description = ratechartItemsVm.fieldwork_description; ratechart.unitofmeasurement = ratechartItemsVm.unitofmeasurement; ratechart.price = ratechartItemsVm.price; }
public HttpResponseMessage SaveRateChart(HttpRequestMessage request, SubContractorRateChartViewModel ratechart) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (!ModelState.IsValid) { response = request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } else { tbl_subcontractor_ratechart newRateChartDetails = new tbl_subcontractor_ratechart(); for (int i = 0; i < ratechart.ratechartdetails.Count; i++) { newRateChartDetails.tenant_id = ratechart.tenant_id; newRateChartDetails.projectid = ratechart.projectid; newRateChartDetails.subcontractor_id = ratechart.subcontractor_id; newRateChartDetails.fieldwork_id = ratechart.ratechartdetails[i].fieldwork_id; newRateChartDetails.fieldwork_description = ratechart.ratechartdetails[i].fieldwork_description; newRateChartDetails.unitofmeasurement = ratechart.ratechartdetails[i].unitofmeasurement; newRateChartDetails.price = ratechart.ratechartdetails[i].price; _ratechartRepository.Add(newRateChartDetails); _unitOfWork.Commit(); } response = request.CreateResponse <SubContractorRateChartViewModel>(HttpStatusCode.Created, ratechart); } return response; })); }
public static void Addratechart(this tbl_subcontractor_ratechart ratechart, SubContractorRateChartViewModel ratechartVm) { ratechart.tenant_id = ratechartVm.tenant_id; ratechart.projectid = ratechartVm.projectid; ratechart.subcontractor_id = ratechartVm.subcontractor_id; }