public int Edit(ClinicAccount clinicAccount) { int editIndex = 0; try { List <ClinicAccount> clinic = GetAllATotalIncomeById(); ClinicAccount _clinicAccount = GetAccountiesById(clinicAccount.ClinicAccountId); _clinicAccount.ClinicAccountId = clinicAccount.ClinicAccountId; _clinicAccount.Income = clinicAccount.Income; _clinicAccount.OutCome = clinicAccount.OutCome; _clinicAccount.Date = clinicAccount.Date; _clinicAccount.DayTotalIncome = clinicAccount.Income - clinicAccount.OutCome; _clinicAccount.TotalIncome = clinicAccount.TotalIncome; //foreach (ClinicAccount account in clinic) //{ // _clinicAccount.TotalIncome += account.DayTotalIncome; //} editIndex = _clinicAccountRepository.Edit(_clinicAccount); } catch (Exception exception) { throw new Exception(exception.Message); } return(editIndex); }
public JsonResult Save(ClinicAcountViewModel model) { int saveIndex = 0; ClinicAccount clinicAccount = new ClinicAccount(); clinicAccount.ClinicAccountId = model.ClinicAccountId; clinicAccount.Income = model.Income; clinicAccount.OutCome = model.OutCome; clinicAccount.Date = model.Date; clinicAccount.DayTotalIncome = clinicAccount.Income - clinicAccount.OutCome; clinicAccount.TotalIncome = clinicAccount.DayTotalIncome; List <ClinicAccount> allATotalIncomeById = GetAllATotalIncomeById(); foreach (ClinicAccount account in allATotalIncomeById) { clinicAccount.TotalIncome += account.DayTotalIncome; } saveIndex = model.ClinicAccountId == 0 ? ClinicAccountManager.Save(clinicAccount) : ClinicAccountManager.Edit(clinicAccount);; return(Reload(saveIndex)); }
public List <ClinicAccount> GetAllAccountByPaging(out int totalrecords, ClinicAccount model) { List <ClinicAccount> clinicAccounts; try { clinicAccounts = _clinicAccountRepository.GetAllAccountByPaging(out totalrecords, model); } catch (Exception exception) { throw new Exception(exception.Message); } return(clinicAccounts); }
public int Save(ClinicAccount clinicAccount) { int saveIndex = 0; try { clinicAccount.IsActive = true; //clinicAccount.TotalIncome = clinicAccount.TotalIncome + clinicAccount.DayTotalIncome; saveIndex = _clinicAccountRepository.Save(clinicAccount); } catch (Exception exception) { throw new Exception(exception.Message); } return(saveIndex); }
public ActionResult Edit(ClinicAcountViewModel model) { ClinicAccount clinicAccount = ClinicAccountManager.GetAccountiesById(model.ClinicAccountId); if (model.ClinicAccountId > 0) { model.ClinicAccountId = clinicAccount.ClinicAccountId; model.Income = clinicAccount.Income; model.OutCome = clinicAccount.OutCome; model.Date = clinicAccount.Date; model.DayTotalIncome = clinicAccount.DayTotalIncome; model.TotalIncome = clinicAccount.TotalIncome; } return(View(model)); }
public int Delete(int id) { int deleteIndex = 0; try { ClinicAccount clinicAccount = GetAccountiesById(id); clinicAccount.IsActive = false; deleteIndex = _clinicAccountRepository.Edit(clinicAccount); } catch (Exception exception) { throw new Exception(exception.Message); } return(deleteIndex); }