public void AddUpdateCase(AccountCaseModel caseModel, int companyId) { AccountCase cases = new AccountCase(); //if account id is 0 then account will be added if (caseModel.AccountCaseId == 0) { AutoMapper.Mapper.Map(caseModel, cases); cases.CreatedDate = DateTime.UtcNow; cases.RecordDeleted = false; cases.CaseNumber = caseModel.AccountId.ToString("00000"); cases.CreatedBy = caseModel.CreatedBy; accountcaseRepository.Insert(cases); cases.CaseNumber = cases.CaseNumber + "-" + cases.AccountCaseId.ToString("00000"); accountcaseRepository.Update(cases); } else //if account id is not 0 then account will be updated { cases = accountcaseRepository.SingleOrDefault(x => x.AccountCaseId == caseModel.AccountCaseId); caseModel.CreatedDate = cases.CreatedDate; AutoMapper.Mapper.Map(caseModel, cases); cases.ModifiedBy = caseModel.ModifiedBy; cases.ModifiedDate = DateTime.UtcNow; accountcaseRepository.Update(cases); } }
public AccountCaseModel GetCase(int caseId) { AccountCaseModel caseModel = new AccountCaseModel(); AccountCase cases = accountcaseRepository.GetAll(t => t.AccountCaseId == caseId && t.RecordDeleted == false).FirstOrDefault(); AutoMapper.Mapper.Map(cases, caseModel); return(caseModel); }
public AccountCaseModel CaseDetail(int caseId) { AccountCaseModel casemodel = null; AccountCase cases = accountcaseRepository.SingleOrDefault(u => u.AccountCaseId == caseId && u.RecordDeleted == false); casemodel = new AccountCaseModel(); if (cases != null) { AutoMapper.Mapper.Map(cases, casemodel); //AutoMapper.Mapper.Map(cases.FileAttachments, casemodel.FileAttachmentModels); } return(casemodel); }
public void Case(AccountCaseModel caseModel) { AccountCase cases = new ErucaCRM.Repository.AccountCase(); AutoMapper.Mapper.Map(caseModel, cases); if (caseModel.AccountCaseId > 0) { accountcaseRepository.Update(cases); } else { accountcaseRepository.Insert(cases); } }
public AccountCaseModel GetAccountCaseInfo(int accountCaseId) { AccountCaseModel accountCaseModel;//= accountcaseRepository.GetAll(x => x.AccountCaseId == accountCaseId).Select(y => new AccountCaseModel() { AccountCaseId = y.AccountCaseId, CaseNumber = y.CaseNumber, AccountId = y.AccountId.GetValueOrDefault(), AccountName = y.Account.AccountName, }).FirstOrDefault(); AccountCase accountCase = accountcaseRepository.SingleOrDefault(x => x.AccountCaseId == accountCaseId && x.RecordDeleted == false); accountCaseModel = new AccountCaseModel(); if (accountCase != null) { accountCaseModel.AccountCaseId = accountCase.AccountCaseId; accountCaseModel.CaseNumber = accountCase.CaseNumber; accountCaseModel.AccountId = accountCase.AccountId.GetValueOrDefault(); accountCaseModel.AccountName = accountCase.Account.AccountName; } return(accountCaseModel); }