コード例 #1
0
        public Side EditSide(Side sideData)
        {
            var side = GetSideById(sideData.Id);

            side.Name        = sideData.Name;
            side.Description = sideData.Description;
            side.Price       = sideData.Price;

            bool success = _repo.SaveSide(side);

            if (!success)
            {
                throw new Exception("Side couldn't be saved. Please try again");
            }
            return(side);
        }
コード例 #2
0
        public Side EditSide(Side sideData)
        {
            var side = _repo.GetSideById(sideData.Id);

            if (side == null)
            {
                throw new Exception("I DONT LIKE BAD ID's");
            }
            side.Name        = sideData.Name;
            side.Description = sideData.Description;
            side.Price       = sideData.Price;
            bool success = _repo.SaveSide(side);

            if (!success)
            {
                throw new Exception("Nope I couldn't update the side.... Please Try Again Later, or now is probably fine");
            }

            return(side);
        }