public async Task <JsonResult> Save(MinimunSalaryModel minimunSalary) { //Create object to save/update var ms = new MinimunSalary { ExpirationDate = CotorraTools.ValidateDate(minimunSalary.ExpirationDate), ZoneA = minimunSalary.ZoneA, ZoneB = minimunSalary.ZoneB, ZoneC = minimunSalary.ZoneC, InstanceID = SessionModel.InstanceID, CompanyID = SessionModel.CompanyID, IdentityID = SessionModel.IdentityID, }; if (!minimunSalary.ID.HasValue) { ms.ID = Guid.NewGuid(); await client.CreateAsync(new List <MinimunSalary>() { ms }, SessionModel.CompanyID); } else { ms.ID = minimunSalary.ID.Value; await client.UpdateAsync(new List <MinimunSalary>() { ms }, SessionModel.CompanyID); } return(Json(ms.ID)); }
public async Task <JsonResult> SaveAboutData(PayrollCompanyConfigurationDTO data) { var id = data.ID.HasValue ? data.ID.Value : Guid.NewGuid(); if (!data.ID.HasValue) { throw new CotorraException(101, "101", "No es posible crear otra configuración, sólo se puede tener 1 por empresa", null); } else { var payrollConfiguration = (await _clientConfiguration.FindAsync(p => p.ID == id, SessionModel.CompanyID)).FirstOrDefault(); payrollConfiguration.ComercialName = data.ComercialName; payrollConfiguration.CompanyBusinessSector = data.CompanyBusinessSector; payrollConfiguration.CompanyCreationDate = string.IsNullOrEmpty(data.CompanyCreationDate) ? (DateTime?)null : CotorraTools.ValidateDate(data.CompanyCreationDate); payrollConfiguration.CompanyWebSite = data.CompanyWebSite; payrollConfiguration.Facebook = data.Facebook; payrollConfiguration.Instagram = data.Instagram; payrollConfiguration.CompanyScope = data.CompanyScope; payrollConfiguration.CompanyInformation = data.CompanyInformation; var resultJSON = SaveConfiguration(payrollConfiguration); } return(Json(data)); }