public long Update(long brokerId, string name, string login, string email) { var entity = _context.Brokers.First(x => x.Id == brokerId); entity.Name = name; entity.User.Login = login; entity.Email = email; _context.SaveChanges(); return(entity.UserId); }
public long Add(ApplicationEditData application) { var entity = new DbContext.Application(); Map(application, entity); entity.StateId = _defaultStateId; entity.StateChangeTimestamp = DateTimeProvider.Now; entity.DisplayNumber = _executor.Query <int>("[dbo].[GetNextDisplayNumber]"); entity.CreationTimestamp = DateTimeProvider.Now; _context.Applications.InsertOnSubmit(entity); _context.SaveChanges(); return(entity.Id); }
public IActionResult Index(Tracker tracker) { if (!ModelState.IsValid) { ViewBag.TrackerList = _trackerDb.Trackers.ToList(); return(View()); } _trackerDb.Trackers.Add(tracker); _trackerDb.SaveChanges(); return(RedirectToAction()); }
public long Add(AirWaybillEditData data, long stateId, long creatorUserId) { var entity = new AirWaybill { CreationTimestamp = DateTimeProvider.Now, StateChangeTimestamp = DateTimeProvider.Now, StateId = stateId, IsActive = true, CreatorUserId = creatorUserId }; Map(data, entity); _context.AirWaybills.InsertOnSubmit(entity); _context.SaveChanges(); return(entity.Id); }