public bool UpdateUnregisteredGuest(UnregisteredGuestEnitity guest) { if (guest != null) { _ctx.UnregisteredGuestEnitity.Attach(guest); _ctx.Entry(guest).State = EntityState.Modified; } return(Save()); }
public async Task <IActionResult> PutContent(long id, Content content) { if (id != content.Id) { return(BadRequest()); } _context.Entry(content).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContentExists(id)) { return(NotFound()); } else { throw; } } // return code 204 return(NoContent()); }
public bool UpdateView(ViewEntity updateView) { using (var context = new ContentContext()) { context.ViewEntity.Attach(updateView); context.Entry(updateView).State = EntityState.Modified; return(context.SaveChanges() > 0); } }
public bool CheckIn(int id = 0, string ip = "") { var avatar = new AvatarEntity(); if (id > 0) { avatar = GetAvatarById(id); } if (!string.IsNullOrWhiteSpace(ip)) { avatar = GetAvatarById(ip: ip); } avatar.LastCheckedIn = DateTime.Now; avatar.IsCheckedIn = true; _ctx.Attach(avatar); _ctx.Entry(avatar).State = EntityState.Modified; return(Save()); }
public void Update(T obj) { try { if (obj == null) { throw new Exception("Cannot update null object"); } _context.Entry(obj).State = EntityState.Modified; _context.SaveChanges(); } catch (Exception ex) { throw ex; } }
public bool UpdateAnon(AnonymousEntity anonToUpdate) { _ctx.AnonymousEntity.Attach(anonToUpdate); _ctx.Entry(anonToUpdate).State = EntityState.Modified; return(Save()); }
public void UpdateContent(Content content) { context.Entry(content).State = EntityState.Modified; }
public bool EditOption(EnableOptionsEntity editOption) { _ctx.EnableOptionsEntity.Attach(editOption); _ctx.Entry(editOption).State = EntityState.Modified; return(Save()); }
//public PostRepository(ContentContext context) //{ // _context = context ?? throw new ArgumentNullException(nameof(context)); //} public void Add(Post post) { _context.Posts.Add(post); var st = _context.Entry(post).State; }