public async Task <ActionResult> UpdatePlatformPrice(UpdatedPlatformPriceDto updatedPlatformPrice) { ServiceResponce <GetPlatformPriceDto> serviceResponce = new ServiceResponce <GetPlatformPriceDto>(); serviceResponce = await _PlatformPriceService.UpdatePlatformPrice(updatedPlatformPrice); if (serviceResponce.Data == null) { return(NotFound(serviceResponce)); } return(Ok(serviceResponce)); }
public async Task <ServiceResponce <GetPlatformPriceDto> > UpdatePlatformPrice(UpdatedPlatformPriceDto updatedPlatformPrice) { ServiceResponce <GetPlatformPriceDto> serviceResponce = new ServiceResponce <GetPlatformPriceDto>(); try { PlatformPrice platformprice = await _dataContext.PlatformPrices.FirstOrDefaultAsync(c => c.PlatformPriceId == updatedPlatformPrice.PlatformPriceId && c.IsActive == true); platformprice.PlatformRate = updatedPlatformPrice.PlatformRate; platformprice.GstPlatformRate = updatedPlatformPrice.GstPlatformRate; platformprice.LastModifiedBy = updatedPlatformPrice.LastModifiedBy; platformprice.LastModifiedon = DateTime.Now; _dataContext.PlatformPrices.Update(platformprice); await _dataContext.SaveChangesAsync(); serviceResponce.Data = _mapper.Map <GetPlatformPriceDto>(platformprice); } catch (Exception e) { serviceResponce.Success = false; serviceResponce.Message = e.Message; } return(serviceResponce); }