Exemplo n.º 1
0
 public UserDetailModelDC MapAndSaveUserToUserDetailModelDC(UserDetailModelDC a, UserDetail b)
 {
     a.userId    = b.UserId;
     a.firstName = b.FirstName;
     a.lastName  = b.LastName;
     a.userName  = b.UserName;
     a.isDeleted = b.IsDeleted;
     return(a);
 }
        public int saveUserDetail(UserDetailModel model)
        {
            try
            {

                using (_context= new HSSNInventoryEntities() )
                {
                    var addmodel = new UserDetail()
                    {

                        UserDetailId = model.UserDetailId,
                        Name = model.Name,
                        Address = model.Address,
                        Telephone = model.Telephone,
                        EmailId = model.EmailId,
                        UserName = model.UserName,
                        Password = model.Password,
                        DisplayName = model.DisplayName,
                        OrganisationId = model.OrganisationId,
                        CreatedDate = model.CreatedDate,
                        CreatedBy = model.CreatedBy,
                        ProfileId = model.ProfileId,

                    };
                    _context.Entry(addmodel).State = EntityState.Added;
                    _context.SaveChanges();
                    return addmodel.UserDetailId;
                }

            }
            catch (Exception e)
            {

                Console.WriteLine(e);
                throw;
            }
        }