Example #1
0
        public async Task <ActionResponse <ClassLocationsDto> > Update(ClassLocationsDto entityDto)
        {
            try
            {
                var entityToUpdate = mapper.Map <ClassLocationsDto, ClassLocations>(entityDto);
                unitOfWork.GetGenericRepository <ClassLocations>().Update(entityToUpdate);
                unitOfWork.Save();
                await cacheService.RefreshCache <List <ClassLocationsDto> >();

                return(await ActionResponse <ClassLocationsDto>
                       .ReturnSuccess(mapper.Map <ClassLocations, ClassLocationsDto>(entityToUpdate)));
            }
            catch (Exception)
            {
                return(await ActionResponse <ClassLocationsDto> .ReturnError("Greška prilikom ažuriranja mjesta izvođenja."));
            }
            finally
            {
                await cacheService.RefreshCache <List <ClassLocationsDto> >();
            }
        }
 public async Task <ActionResponse <ClassLocationsDto> > Update([FromBody] ClassLocationsDto request)
 {
     return(await classLocationsService.Update(request));
 }