public async Task <VmGenericServiceResult> Update(VmServiceTagsItem vmtem) { VmGenericServiceResult result = new VmGenericServiceResult(); try { Com.BudgetMetal.DBEntities.ServiceTags r = await repo.Get(vmtem.Id); Copy <VmServiceTagsItem, Com.BudgetMetal.DBEntities.ServiceTags>(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 VmGenericServiceResult Insert(VmServiceTagsItem vmtem) { VmGenericServiceResult result = new VmGenericServiceResult(); try { Com.BudgetMetal.DBEntities.ServiceTags r = new Com.BudgetMetal.DBEntities.ServiceTags(); Copy <VmServiceTagsItem, Com.BudgetMetal.DBEntities.ServiceTags>(vmtem, r); if (r.CreatedBy.IsNullOrEmpty()) { r.CreatedBy = r.UpdatedBy = "System"; } // r.Industry_Id = 1;//hard code repo.Add(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.ServiceTags r = await repo.Get(Id); r.IsActive = false; repo.Update(r); repo.Commit(); }