Exemplo n.º 1
0
        public async Task <bool> Update(AuditPicMDto model)
        {
            var auditPicM = _mapper.Map <MES_Audit_PIC_M>(model);

            _repo.Update(auditPicM);
            return(await _repo.SaveAll());
        }
Exemplo n.º 2
0
 public async Task <IActionResult> Update([FromBody] AuditPicMDto model)
 {
     if (await _service.Update(model))
     {
         return(NoContent());
     }
     return(BadRequest($"Updating Audit PicM {model.PIC_Type_ID} failed on save"));
 }
Exemplo n.º 3
0
 public async Task <IActionResult> Update([FromBody] AuditPicMDto auditPicM)
 {
     if (await _auditPicMService.Update(auditPicM))
     {
         return(NoContent());
     }
     throw new Exception($"Updating Audit PicM {auditPicM.PIC_Type_ID} failed on save");
 }
Exemplo n.º 4
0
        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());
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Create(AuditPicMDto auditPicM)
        {
            var username = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            auditPicM.Updated_By = username;
            if (await _service.Add(auditPicM))
            {
                return(CreatedAtRoute("GetAuditPicMs", new {}));
            }
            throw new Exception("Creating the Audit PicM failed on save");
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Create(AuditPicMDto auditPicM)
        {
            if (await _service.CheckAuditPicMExists(auditPicM.PIC_Type_ID))
            {
                return(BadRequest("PIC Type ID already exits!"));
            }
            var username = User.FindFirst(ClaimTypes.Name).Value;

            auditPicM.Updated_By = username;
            if (await _service.Add(auditPicM))
            {
                return(CreatedAtRoute("GetAuditPicMs", new {}));
            }
            throw new Exception("Creating the Audit PicM failed on save");
        }
Exemplo n.º 7
0
        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());
        }