public FileItResponse AddUpdateUser(string user, string pass, FileItUser userobj)
        {
            var response = new FileItResponse();

            using (var db = new FileItDataLayer.Models.SystemFileitEntities())
            {
                var loginUser = db.USERS.FirstOrDefault(u => u.USERNAME.Equals(user, StringComparison.CurrentCultureIgnoreCase));
                if (loginUser.Authenticate(pass))
                {
                    var userDb = db.USERS.FirstOrDefault(u => u.USERNAME == userobj.UserName);
                    if (userDb == null)
                    {
                        userDb = new FileItDataLayer.Models.USER();
                    }
                    if (userDb != null)
                    {
                        if (userobj.MergeWithDB(userDb))
                        {
                            db.SaveChanges();
                            response.Success = true;
                        }
                    }
                }
            }
            return(response);
        }
 public bool MergeWithDB(FileItDataLayer.Models.USER user)
 {
     //merge the dto with the database
     user.USERNAME       = this.UserName;
     user.FULLNAME       = this.FullName;
     user.PASS           = this.Pass;
     user.ACCOUNT        = this.Account;
     user.EMAIL          = this.Email;
     user.DESCRIPTION    = this.Description;
     user.PROFILE        = this.Profile;
     user.ActiveUserBool = this.ActiveUser;
     user.PRINTWIDTH     = this.PrintWidth;
     return(true);
 }