public VmGenericServiceResult Insert(VmEmailLogItem vmtem) { VmGenericServiceResult result = new VmGenericServiceResult(); try { Com.BudgetMetal.DBEntities.EmailLog r = new Com.BudgetMetal.DBEntities.EmailLog(); Copy <VmEmailLogItem, Com.BudgetMetal.DBEntities.EmailLog>(vmtem, r); if (r.CreatedBy.IsNullOrEmpty()) { r.CreatedBy = r.UpdatedBy = "System"; } repo.Add(r); repo.Commit(); result.IsSuccess = true; } catch (Exception e) { result.IsSuccess = false; result.Error = e; } return(result); }
public async Task <VmGenericServiceResult> Update(VmEmailLogItem vmtem) { VmGenericServiceResult result = new VmGenericServiceResult(); try { Com.BudgetMetal.DBEntities.EmailLog r = await repo.Get(vmtem.Id); Copy <VmEmailLogItem, Com.BudgetMetal.DBEntities.EmailLog>(vmtem, r); if (r.UpdatedBy.IsNullOrEmpty()) { r.UpdatedBy = "System"; } repo.Update(r); repo.Commit(); result.IsSuccess = true; } catch (Exception e) { result.IsSuccess = false; result.Error = e; } return(result); }
public async Task Delete(int Id) { Com.BudgetMetal.DBEntities.EmailLog r = await repo.Get(Id); r.IsActive = false; repo.Update(r); repo.Commit(); }