public ActionResult UpdateFormula(Formulas formula) { if (formula != null) { try { var formulaFromDb = testsService.GetFormula(formula.Id); formulaFromDb.Formula = formula.Formula; formulaFromDb.ModifiedBy = formula.ModifiedBy; formulaFromDb.ModifiedDate = formula.ModifiedDate; formulaFromDb.TestId = formula.TestId; formulaFromDb.TitleId = formula.TitleId; formulaFromDb.GroupId = formula.GroupId; testsService.UpdateFormula(formulaFromDb); } catch (Exception e) { Program.Logger.Error(e); return(Ok(GetResponse(ResponseType.FAIL, ResponseStatusCode.FAIL, GetError(ErrorCodes.dataNotFound, "Failed", "Error occurred while updating the formula")))); } return(Ok(GetResponse(ResponseType.ACK, ResponseStatusCode.SUCCESS))); } else { return(BadRequest(GetResponse(ResponseType.ERROR, ResponseStatusCode.ERROR, GetError(ErrorCodes.invalidData, "Invalid input", "Please enter proper other formula details")))); } }