Esempio n. 1
0
        public async Task SaveAsync(MaritalStatus entity)
        {
            try
            {
                if (entity == null)
                {
                    return;
                }

                using (var timeLineContext = _contextFactory.GetTimeLineContext())
                {
                    var entityModel = await timeLineContext
                                      .MaritalStatuses
                                      .FirstOrDefaultAsync(item => item.Id.Equals(entity.Id));

                    if (entityModel == null)
                    {
                        entityModel = new DA.MaritalStatus();
                        MapForUpdateentity(entity, entityModel);
                        await timeLineContext.MaritalStatuses.AddAsync(entityModel);
                    }
                    else
                    {
                        MapForUpdateentity(entity, entityModel);
                    }


                    timeLineContext.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
 private void MapForUpdateentity(MaritalStatus entity, DA.MaritalStatus daEntity)
 {
     daEntity.Id = entity.Id;
 }