public SaveResult Delete(LOGProcessHistoryDto entity) { throw new NotImplementedException(); }
public Task<SaveResult> DeleteAsync(LOGProcessHistoryDto entity) { throw new NotImplementedException(); }
/// <summary> /// Adds the asynchronous. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> public async Task<SaveResult> AddAsync(LOGProcessHistoryDto entity) { SaveResult result = SaveResult.FAILURE; try { using (FailureAnalysisEntities context = new FailureAnalysisEntities()) { LOG_ProcessHistory add = context.LOG_ProcessHistory.Create(); add.ProcessHisId = entity.ProcessHisId; add.InsertedBy = entity.InsertedBy; add.PlanTo = entity.PlanTo; add.PlanFrom = entity.PlanFrom; add.PlanType = (byte)entity.PlanType; add.Description = entity.Description; add.InsertedDate = DateTime.Now; context.Entry<LOG_ProcessHistory>(add).State = System.Data.Entity.EntityState.Added; result = await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE; } } catch (Exception ex) { _logService.Error(ex.Message, ex); result = SaveResult.FAILURE; } return result; }