Пример #1
0
        public async Task <MemberModel> AddMemberAsync(MemberModel member)
        {
            _context.Members.Add(member);
            await _context.SaveChangesAsync();

            return(member);
        }
Пример #2
0
 public async Task SaveAnnouncementAsync(AnnouncementModel model)
 {
     if (model != null)
     {
         if (model.Id == 0) //Id = 0 then this is a new announcement, otherwise it's existing
         {
             _context.Announcements.Add(model);
         }
         else
         {
             _context.Announcements.Attach(model);
             _context.Entry(model).State = EntityState.Modified;
         }
         await _context.SaveChangesAsync();
     }
 }
Пример #3
0
 public async Task SavePartAsync(PartModel part)
 {
     _db.Parts.Add(part);
     await _db.SaveChangesAsync();
 }
Пример #4
0
        public async Task AddActivityAsync(ActivityModel newActivity)
        {
            await _context.Activities.AddAsync(newActivity);

            await _context.SaveChangesAsync();
        }
Пример #5
0
 public async Task AddComputerAsync(ComputerModel newComputer)
 {
     _context.Computers.Add(newComputer);
     await _context.SaveChangesAsync();
 }