public async Task <IActionResult> UpdatePassword(UserDetail entity) { var model = await _UserDetailService.GetSingle(x => x.Id == Convert.ToInt32(HttpContext.Session.GetInt32("userId"))); model.Password = entity.Password; var udpateModel = CommanCRUDHelper.CommanUpdateCode(model, Convert.ToInt32(HttpContext.Session.GetInt32("userId"))); var response = await _UserDetailService.Update(udpateModel); return(Json(ResponseHelper.GetResponseMessage(response))); }
public async Task <IActionResult> UpSertEmployeeDetail(EmployeeDetail model) { if (model.Id > 0) { var updateModel = CommanCRUDHelper.CommanUpdateCode(model, 1); var updateResponse = await _IEmployeeDetailService.Update(updateModel); return(Json(ResponseHelper.GetResponseMessage(updateResponse))); } var createModel = CommanCRUDHelper.CommanCreateCode(model, 1); var createResponse = await _IEmployeeDetailService.CreateEntity(createModel); return(Json(ResponseHelper.GetResponseMessage(createResponse))); }
public async Task <IActionResult> UpSertCustomer(CustomerMaster modelEntity) { if (modelEntity.Id == 0) { var createHelperModel = CommanCRUDHelper.CommanCreateCode(modelEntity, 1); var createResponse = await _ICustomerMasterService.CreateEntity(createHelperModel); return(Json(ResponseHelper.GetResponseMessage(createResponse))); } var updateHelperModel = CommanCRUDHelper.CommanUpdateCode(modelEntity, 1); var updateResponse = await _ICustomerMasterService.Update(updateHelperModel); return(Json(ResponseHelper.GetResponseMessage(updateResponse))); }
public async Task <IActionResult> UpSertUserDetail(UserDetail modelEntity) { if (modelEntity.Id > 0) { var updateModel = CommanCRUDHelper.CommanUpdateCode(modelEntity, 1); var updateResponse = await _IUserDetailService.Update(updateModel); return(Json(ResponseHelper.GetResponseMessage(updateResponse))); } var createModel = CommanCRUDHelper.CommanCreateCode(modelEntity, 1); var createReposnse = await _IUserDetailService.Update(createModel); return(Json(ResponseHelper.GetResponseMessage(createReposnse))); }
public async Task <IActionResult> UpsertDetail(IGL.Core.Entities.Organization.Organisation modelEntity) { if (modelEntity.Id == 0) { var createModel = CommanCRUDHelper.CommanCreateCode(modelEntity, 1); var response = await _IOrganisationService.CreateEntity(createModel); return(Json(ResponseHelper.GetResponseMessage(response))); } var updateModel = CommanCRUDHelper.CommanUpdateCode(modelEntity, 1); var updateResponse = await _IOrganisationService.Update(updateModel); return(Json(ResponseHelper.GetResponseMessage(updateResponse))); }
public async Task <IActionResult> UpSertVendor(VendorMaster model) { if (model.Id == 0) { var createModel = CommanCRUDHelper.CommanCreateCode(model, 1); var response = await _IVendorMasterService.CreateEntity(createModel); return(Json(ResponseHelper.GetResponseMessage(response))); } var updateModel = CommanCRUDHelper.CommanUpdateCode(model, 1); var updateRespose = await _IVendorMasterService.Update(updateModel); return(Json(ResponseHelper.GetResponseMessage(updateRespose))); }
public async Task<IActionResult> UpSertMaterial(MaterialMaster model) { if (model.Id == 0) { var createModel = CommanCRUDHelper.CommanCreateCode(model, 1); var createResponse = await _IMaterialMasterService.CreateEntity(createModel); var createdPrdctId = (await _IMaterialMasterService.GetList(x => x.IsActive == 1)).Max(x => x.Id); var rateMasterResponse = await UpdateRateMaster(createdPrdctId, model.PerUnitCost); return Json(ResponseHelper.GetResponseMessage(createResponse)); } else { var updateModel = CommanCRUDHelper.CommanUpdateCode(model, 1); var updateResponse = await _IMaterialMasterService.Update(updateModel); var rateMasterResponse = await UpdateRateMaster(model.Id, model.PerUnitCost); return Json(ResponseHelper.GetResponseMessage(updateResponse)); } }
public async Task <IActionResult> CreateSIVDetail(SIVDetail model, string[] matId, string[] unitPrice, string[] qty, string[] Remarks, string Save) { if (Save.ToLower().Trim() == "save") { var createHelper = CommanCRUDHelper.CommanCreateCode(model, 1); var createResponse = await _ISIVDetailService.CreateEntity(createHelper); var purchasedetail = await _IPoDetailService.GetSingle(x => x.Id == model.PoId); purchasedetail.POStatus = "SIVCreated"; var updatePo = await _IPoDetailService.Update(purchasedetail); if (createResponse == ResponseMessage.AddedSuccessfully) { var SIVDetails = await _ISIVDetailService.GetList(x => x.IsActive == 1); List <SIVMaterialTransaction> models = new List <SIVMaterialTransaction>(); for (int i = 0; i < matId.Count(); i++) { SIVMaterialTransaction itemData = new SIVMaterialTransaction(); itemData.ItemId = Convert.ToInt32(matId[i]); itemData.UnitPrice = Convert.ToDecimal(unitPrice[i]); itemData.Quantity = Convert.ToInt32(qty[i]); itemData.ItemNumber = string.Empty; itemData.SIVId = SIVDetails.Max(x => x.Id); models.Add(itemData); } var createSIVItemResponse = await _ISIVTransactionService.Add(models.ToArray()); return(Json(ResponseHelper.GetResponseMessage(createSIVItemResponse))); } } else { var purchasedetail = await _IPoDetailService.GetSingle(x => x.Id == model.PoId); purchasedetail.POStatus = "SIVApproved"; var updatePo = await _IPoDetailService.Update(purchasedetail); var sivDetail = await _ISIVDetailService.GetSingle(x => x.PoId == model.PoId && x.IsActive == 1); sivDetail.InvoiceDate = model.InvoiceDate; sivDetail.InvoiceNumber = model.InvoiceNumber; sivDetail.InvoicePath = model.InvoicePath; sivDetail.StoreId = model.StoreId; var updateSivModelHelper = CommanCRUDHelper.CommanUpdateCode(sivDetail, 1); var updateSIVResponse = await _ISIVDetailService.Update(updateSivModelHelper); if (updateSIVResponse == ResponseMessage.UpdatedSuccessfully) { var sivItemDetails = await _ISIVTransactionService.GetList(x => x.SIVId == sivDetail.Id && x.IsActive == 1); sivItemDetails.ToList().ForEach(item => { item.IsActive = 0; item.IsDeleted = 1; item.UpdatedDate = DateTime.Now.Date; item.UpdatedBy = 1; }); var deleteResponse = await _ISIVTransactionService.Update(sivItemDetails.ToArray()); if (deleteResponse == ResponseMessage.UpdatedSuccessfully) { List <SIVMaterialTransaction> models = new List <SIVMaterialTransaction>(); for (int i = 0; i < matId.Count(); i++) { SIVMaterialTransaction itemData = new SIVMaterialTransaction(); itemData.ItemId = Convert.ToInt32(matId[i]); itemData.UnitPrice = Convert.ToDecimal(unitPrice[i]); itemData.Quantity = Convert.ToInt32(qty[i]); itemData.ItemNumber = string.Empty; itemData.SIVId = sivDetail.Id; models.Add(itemData); } var createSIVItemResponse = await _ISIVTransactionService.Add(models.ToArray()); var responseUpdate = await UpdateProductOnSIVApprove(matId, qty, unitPrice); var updateRateMaster = await UpdateRateMaster(matId, unitPrice); return(Json(ResponseHelper.GetResponseMessage(createSIVItemResponse))); } } } return(Json("There is somethng wents wrong. Please contact Admin Team.")); }