public async Task Update(CommonUpdateDto dto)
        {
            var repository = DataContextManager.CreateRepository <ICommonRepository <TEntity> >();

            var entity = await repository.GetById(dto.Id);

            if (entity == null)
            {
                throw new ObjectNotFoundException();
            }

            var existingEntity = await repository.GetByName(dto.Name, dto.Id);

            if (existingEntity != null)
            {
                throw new UpdatingException();
            }

            entity.Name       = dto.Name;
            entity.UpdateDate = DateTime.Now;

            await repository.Update(entity);
        }
        public async Task <ActionResult> UpdateGearOil([FromBody] CommonUpdateDto gearOil)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            try
            {
                await _service.Update(gearOil);

                return(Ok());
            }
            catch (ObjectNotFoundException onfex)
            {
                _log.Error(onfex);
                return(StatusCode((int)HttpStatusCode.Forbidden, ErrorMessage.NOTEXIST.ToString()));
            }
            catch (UpdatingException uex)
            {
                _log.Error(uex);
                return(StatusCode((int)HttpStatusCode.Forbidden, ErrorMessage.SAMENAME.ToString()));
            }
        }