public async Task <bool> Add(AuditPicMDto model) { var auditPicM = _mapper.Map <MES_Audit_PIC_M>(model); _repo.Add(auditPicM); return(await _repo.SaveAll()); }
public async Task <bool> Add(AuditPicMDto model) { var auditPicM = _mapper.Map <MES_Audit_PIC_M>(model); //Get max ID int maxID = _repo.FindAll().Select(x => x.PIC_Type_ID).Select(int.Parse).ToList().Max(); auditPicM.PIC_Type_ID = (maxID + 1).ToString(); _repo.Add(auditPicM); return(await _repo.SaveAll()); }
public async Task <bool> Add(AuditPicMDto model) { var auditPicM = _mapper.Map <MES_Audit_PIC_M>(model); //Get max ID try { int maxID = _repoPicM.FindAll().Select(x => x.PIC_Type_ID).Select(int.Parse).ToList().Max(); auditPicM.PIC_Type_ID = (maxID + 1).ToString(); } catch (System.Exception ex) { throw ex; } _repoPicM.Add(auditPicM); return(await _repoPicM.SaveAll()); }