Example #1
0
        public ActionResult Edit(int id)
        {
            M_Profile model = new M_Profile();

            model = M_Profile.Edit(id);
            return(View(model));
        }
Example #2
0
        public ActionResult ShowProfile()
        {
            userID = GetUser();
            int       id    = UsersProfile.findProfile(userID);
            M_Profile model = new M_Profile();

            if (id != 0)
            {
                model = M_Profile.ViewProfile(id);
            }
            return(View(model));
        }
Example #3
0
        public ActionResult unClaimProfile(string id_authors = "", string auth_id = "")
        {
            M_Profile profile = new M_Profile();
            string    result  = profile.unClaimProfile(id_authors, auth_id);

            if (result == "success")
            {
                Response.Redirect("/show");
            }
            else
            {
                Response.Redirect("/show?error=1");
            }
            return(View());
        }
Example #4
0
        public ActionResult claim(string id_authors = "", string auth_id = "")
        {
            M_Profile profile = new M_Profile();
            string    result  = profile.claimProfile(id_authors, auth_id);

            if (result == "success")
            {
                Response.Redirect("/c_profile/search?keyword=" + Session["username"]);
            }
            else
            {
                Response.Redirect("/c_profile/show?error=1");
            }
            return(View());
        }
Example #5
0
        public ActionResult Save(HttpPostedFileBase Uploadlogo, M_Profile model)
        {
            int pid = 0;

            userID = GetUser();
            if (ModelState.IsValid)
            {
                if (Uploadlogo != null && Uploadlogo.ContentLength > 0)
                {
                    string fileName = System.IO.Path.GetFileNameWithoutExtension(Uploadlogo.FileName);
                    string ext      = System.IO.Path.GetExtension(Uploadlogo.FileName);
                    try
                    {
                        string logofile = User.Identity.GetUserId() + ext;
                        var    path     = System.IO.Path.Combine(Server.MapPath("~/Logo"), logofile);
                        Uploadlogo.SaveAs(path);
                        model.CompanyLogo = logofile;
                        model.UserID      = User.Identity.GetUserId();
                        try
                        {
                            model.SaveProfile(userID);
                            pid            = model.Pid;
                            TempData["id"] = pid;
                        }
                        catch (M_CustomException ex)
                        {
                            ex.LogException();
                            return(RedirectToAction("Index"));
                        }
                    }
                    catch (M_CustomException ex)
                    {
                        if (ex.ErrorCode == 100)
                        {
                            ModelState.AddModelError("error", ex.message);
                            return(RedirectToAction("Creation"));
                        }
                        else if (ex.ErrorCode == 101)
                        {
                            ModelState.AddModelError("Error", "logical exception");
                            return(RedirectToAction("Creation"));
                        }
                    }
                }
            }
            return(RedirectToAction("ShowProfile", pid));
        }
Example #6
0
        public ActionResult Edit(HttpPostedFileBase Uploadlogo, M_Profile model)
        {
            if (Uploadlogo != null && Uploadlogo.ContentLength > 0)
            {
                string fileName = System.IO.Path.GetFileNameWithoutExtension(Uploadlogo.FileName);
                string ext      = System.IO.Path.GetExtension(Uploadlogo.FileName);
                string logofile = User.Identity.GetUserId() + ext;
                var    path     = System.IO.Path.Combine(Server.MapPath("~/Logo"), logofile);
                Uploadlogo.SaveAs(path);
                model.CompanyLogo = logofile;

                try
                {
                    model.UpdateProfile();
                    TempData["id"] = model.Pid;
                }
                catch (Exception)
                {
                    throw;
                }
            }

            else
            {
                try
                {
                    model.UpdateProfile();
                    TempData["id"] = model.Pid;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(RedirectToAction("ShowProfile", model.Pid));
        }