Exemplo n.º 1
0
        public async Task <DomainRoomType> CreateAsync(RoomTypeUpdateModel model)
        {
            var result = await Context.RoomTypes.AddAsync(Mapper.Map <EntityRoomType>(model));

            await Context.SaveChangesAsync();

            return(Mapper.Map <DomainRoomType>(result.Entity));
        }
Exemplo n.º 2
0
        public async Task <DomainRoomType> UpdateAsync(RoomTypeUpdateModel model)
        {
            var existing = await Get(model);

            Context.Entry(existing).State = EntityState.Modified;
            var result = Mapper.Map(model, existing);

            Context.Update(result);
            await Context.SaveChangesAsync();

            return(Mapper.Map <DomainRoomType>(result));
        }