public TEntity UpdateSync(TEntity entity) { var updateItem = _accessoryRepository.Update(entity); _provider.SaveChanges(); return(updateItem); }
public void Save(ExampleTopic model) { var topic = _topicRepository.FindById(model.Id); if (topic == null) { throw new NullReferenceException(); } topic.Title = model.Title; topic.Text = model.Text; topic.Status = model.Status; if (model.Picture != null) { using (MemoryStream ms = new MemoryStream()) { model.Picture.InputStream.CopyTo(ms); if (topic.PictureId == null) { topic.Picture = new BinaryData(); } topic.Picture.Data = ms.GetBuffer(); topic.Picture.MimeType = model.Picture.ContentType; } } _topicRepository.Update(topic); _provider.SaveChanges(); }
public void Remove(int id) { var message = _messageRepository.FindById(id); if (message == null) { throw new NullReferenceException(); } _messageRepository.Delete(message.Id); _provider.SaveChanges(); }
public void Save(ExampleSection model) { var section = _sectionRepository.FindById(model.Id); if (section == null) { throw new NullReferenceException(); } section.Title = model.Title; section.Description = model.Description; _sectionRepository.Update(section); _provider.SaveChanges(); }