Example #1
0
        public ActionResult UpgradeFurniture(long houseID, int furnitureTypeID)
        {
            var house = houseRepository.GetById(houseID);

            var result = houseService.CanModifyHouse(house, SessionHelper.CurrentEntity);

            if (result.IsError)
            {
                return(RedirectBackWithError(result));
            }
            var furnitureType = (FurnitureTypeEnum)furnitureTypeID;

            result = houseService.CanUpgradeFurniture(house, furnitureType);
            if (result.IsError)
            {
                return(RedirectBackWithError(result));
            }

            houseService.UpgradeFurniture(house, furnitureType);

            return(RedirectBackWithSuccess($"{furnitureType.ToHumanReadable().FirstUpper()} has been upgraded!"));
        }