Example #1
0
 public void Save(NumberSeriesView viewTable)
 {
     if (viewTable.Id == null)
     {
         var domainTable = new NumberSeriesTable();
         Mapper.Map(viewTable, domainTable);
         SaveDomain(domainTable);
     }
     else
     {
         var domainTable = Find(viewTable.Id);
         Mapper.Map(viewTable, domainTable);
         SaveDomain(domainTable);
     }
 }
Example #2
0
        public void SaveDomain(NumberSeriesTable domainTable, string currentUserName = "")
        {
            string          localUserName = getCurrentUserName(currentUserName);
            ApplicationUser user          = _AccountService.FirstOrDefault(x => x.UserName == localUserName);

            if (domainTable.Id == Guid.Empty)
            {
                domainTable.Id                        = Guid.NewGuid();
                domainTable.CreatedDate               = DateTime.UtcNow;
                domainTable.ModifiedDate              = domainTable.CreatedDate;
                domainTable.ApplicationUserCreatedId  = user.Id;
                domainTable.ApplicationUserModifiedId = user.Id;
                repo.Add(domainTable);
            }
            else
            {
                domainTable.ModifiedDate = DateTime.UtcNow;
                domainTable.ApplicationUserModifiedId = user.Id;
                repo.Update(domainTable);
            }
            _uow.Save();
        }