Exemple #1
0
        public async Task <ApiResultLite> CreateAsync(RoomFormatCreateRequest model)
        {
            var room = new RoomFormat()
            {
                Name  = model.Name,
                Price = model.Price,
            };

            await _context.AddAsync(room);

            if ((await _context.SaveChangesAsync()) == 0)
            {
                return(new ApiErrorResultLite("Không thể thêm định dạng"));
            }
            return(new ApiSuccessResultLite("Thêm thành công"));
        }
        public async Task<ApiResultLite> CreateAsync(FilmCreateRequest model)
        {
            var room = new Film()
            {
                Name = model.Name,
                Description = model.Description,
                BanId = model.BanId,
                Length = model.Length,
                PublishDate = model.PublishDate,
                TrailerURL = model.TrailerURL
            };

            await _context.AddAsync(room);
            if (await _context.SaveChangesAsync() == 0)
            {
                return new ApiErrorResultLite("Không thể thêm phòng");
            }
            return new ApiSuccessResultLite("Thêm thành công");

        }