예제 #1
0
 public BLL.App.DTO.ComponentTypeMinimal MapToBLL(ComponentTypeEdit apiComponentType)
 {
     return(new BLL.App.DTO.ComponentTypeMinimal
     {
         Id = apiComponentType.Id,
         ComponentTypeName = apiComponentType.ComponentTypeName
     });
 }
        public async Task <IActionResult> PutComponentType(int id, ComponentTypeEdit componentType)
        {
            if (id != componentType.Id)
            {
                return(BadRequest());
            }

            if (!User.IsInRole("Admin"))
            {
                return(Forbid());
            }

            _bll.ComponentTypes.UpdateNoReturnAsync(_mapper.MapToBLL(componentType));

            await _bll.SaveChangesAsync();

            return(NoContent());
        }