Example #1
0
        public ActionResult Create(ProfileEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                ObjectParameter output = new ObjectParameter("responseMessage", typeof(string));
                if (model.type == 6)
                {
                    db.PR_CreateAdmin(model.profileData.IdCard, model.profileData.Username, model.changePass.NewPassword,
                                      model.profileData.FirstName,
                                      model.profileData.MiddleName, model.profileData.LastName, model.profileData.SecondLastName,
                                      output);
                }
                else
                {
                    db.PR_CreateAdminICT(model.profileData.IdCard, model.profileData.Username, model.changePass.NewPassword,
                                         model.profileData.FirstName,
                                         model.profileData.MiddleName, model.profileData.LastName, model.profileData.SecondLastName,
                                         output);
                }

                if (output.Value.Equals("Success"))
                {
                    TempData["Success"] = "Good.";
                }
                else
                {
                    ModelState.AddModelError("", output.Value.ToString());
                }

                return(View(model));
            }
            return(View(model));
        }