Пример #1
0
        public async Task <bool> Add(AuditTypeDto model)
        {
            var auditType = _mapper.Map <MES_Audit_Type_M>(model);

            _repoAuditType.Add(auditType);
            return(await _repoAuditType.SaveAll());
        }
Пример #2
0
 public async Task <IActionResult> Update([FromBody] AuditTypeDto auditTypeDto)
 {
     if (await _auditTypeService.Update(auditTypeDto))
     {
         return(NoContent());
     }
     return(BadRequest($"Updating AuditType {auditTypeDto.Audit_Type_ID} failed on save"));
 }
Пример #3
0
        public async Task <bool> Update(AuditTypeDto model)
        {
            var auditType = _mapper.Map <MES_Audit_Type_M>(model);

            auditType.Updated_Time = DateTime.Now;
            _repoAuditType.Update(auditType);
            return(await _repoAuditType.SaveAll());
        }
Пример #4
0
        public async Task <bool> Add(AuditTypeDto model)
        {
            string auditTypeId = await GetAuditTypeID();

            model.Audit_Type_ID = auditTypeId;
            var auditType = _mapper.Map <MES_Audit_Type_M>(model);

            _repoAuditType.Add(auditType);
            return(await _repoAuditType.SaveAll());
        }
Пример #5
0
        public async Task <IActionResult> Create(AuditTypeDto auditTypeDto)
        {
            if (await _auditTypeService.CheckAuditTypeExists(auditTypeDto.Brand, auditTypeDto.Audit_Type1, auditTypeDto.Audit_Type2, auditTypeDto.Version))
            {
                return(BadRequest("AuditType already exists!"));
            }
            var username = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            auditTypeDto.Updated_By = username;
            if (await _auditTypeService.Add(auditTypeDto))
            {
                return(CreatedAtRoute("GetAuditTypes", new { }));
            }

            throw new Exception("Creating the AuditType failed on save");
        }