public async Task <ApiResponse> Freeze_UnFreeze(FreezeVMRequest entity) { try { var entityDB = await _entityRepository.GetByIdAsync(entity.Id); entityDB.Status = entity.Status; await _entityRepository.UpdateAsync(entityDB); var products = await _productServices.GetProductsByStoreIdALL(entity.Id); foreach (var item in products) { FreezeVMRequest vm = new() { Id = item.Id, Status = entity.Status }; await _productServices.Freeze_UnFreeze(vm); } return(ApiResponse.Create(HttpStatusCode.OK, null)); } catch (Exception) { return(ApiResponse.Create(HttpStatusCode.InternalServerError, null, "InternalServerError_Error")); } }
public async Task Freeze_UnFreeze(FreezeVMRequest entity) { var response = await _httpService.Put <FreezeVMRequest>($"{url}/Freeze_UnFreeze", entity); if (!response.Success) { throw new ApplicationException(await response.GetBody()); } }
public async Task <ActionResult> Freeze_UnFreeze(FreezeVMRequest entity) { #region Start the watch var watch = new Stopwatch(); watch.Start(); #endregion var result = await _entityServices.Freeze_UnFreeze(entity); #region End the watch watch.Stop(); result.Meta.TotalProcessingTime = watch.ElapsedMilliseconds; #endregion return(Ok(result)); }
public async Task <ApiResponse> Freeze_UnFreeze(FreezeVMRequest entity) { try { var entityDB = await _entityRepository.GetByIdAsync(entity.Id); await FreezeWithChildren(entityDB, entity.Status); return(ApiResponse.Create(HttpStatusCode.OK, null)); } catch (Exception) { return(ApiResponse.Create(HttpStatusCode.InternalServerError, null, "InternalServerError_Error")); } }