public IActionResult UpdateFinancialYear([FromBody] FinancialYear model) { if (model.IsActive == true) { try { if (model.FinancialYearId == fin_repo.GetFirst(a => a.CompanyId != null && a.CompanyId == model.CompanyId && a.IsActive == true).FinancialYearId) { model.IsActive = true; } else { model.IsActive = false; } } catch (NullReferenceException) { model.IsActive = true; } } model.Name = model.StartDate.Value.Year.ToString() + '-' + model.EndDate.Value.Year.ToString(); fin_repo.Update(model); return(new OkObjectResult(new { FinancialYearID = model.FinancialYearId })); }
public void Update(FinancialYear entity) { _repository.Update(entity); }