public ResponseUpdateSplitHouse UpdateSplitHouse(int id, RequestUpdateSplitHouse request) { var imagePath = string.Empty; if (!(string.IsNullOrEmpty(request.FileData) || string.IsNullOrEmpty(request.FileName))) { imagePath = SaveImageToWorksampleDirectory(request.FileName, request.FileData, CATALOG_DIRECTORY); } var splitHouseItem = dbManager.GetSplitHouseById(id); if (splitHouseItem == null) { throw new Exception("Не найдена Сплит-система в БД"); } splitHouseItem.EnergoEfficienty = request.EnergoEfficienty; splitHouseItem.Model = request.Model; splitHouseItem.Noise = request.Noise; splitHouseItem.Power = request.Power; splitHouseItem.PowerRealty = request.PowerRealty; splitHouseItem.Price = request.Price; splitHouseItem.SizeExternal = request.SizeExternal; splitHouseItem.SizeInternal = request.SizeInternal; if (!string.IsNullOrEmpty(imagePath)) { splitHouseItem.ImageUrl = imagePath; } dbManager.UpdateSplitHouse(splitHouseItem); return(new ResponseUpdateSplitHouse());; }
public ResponseUpdateSplitHouse UpdateSplitHouse(int id, [FromBody] RequestUpdateSplitHouse request) { return(ExecuteWrapper.Execute(() => { return aManager.UpdateSplitHouse(id, request); })); }