예제 #1
0
        public GuestCategoryDto Create(GuestCategoryDto guestCategoryDto)
        {
            var guestCategory = guestCategoryDto.CreateModel();

            this._context.GuestCategories.Add(guestCategory);
            this._context.SaveChanges();

            return(new GuestCategoryDto(guestCategory));
        }
예제 #2
0
        public GuestCategoryDto Update(GuestCategoryDto guestCategoryDto)
        {
            var guestCategory = this._context.GuestCategories.Find(guestCategoryDto.Id);

            if (guestCategory == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            guestCategoryDto.Update(guestCategory);
            this._context.SaveChanges();

            return(new GuestCategoryDto(guestCategory));
        }