Пример #1
0
        public ActionResult AddMushroom(HttpPostedFileBase fileUpload, string address, string userDescription, string species, string commonName, string capChar, string capColor, string stem, string stemColor, string hymenium, string hymeniumColor, string sporeColor, string ecology, string substrate, string growthPattern)
        {
            FungeyeDAL DAL = new FungeyeDAL();

            if (fileUpload == null)
            {
                ViewBag.ErrorMessage = "We were unable to upload your image. Please try again.";
                return(View("AddMushroom"));
            }

            string pictureURL = DAL.UploadImage(fileUpload);

            string mushroomID = DAL.AddMushroom(species, commonName, capChar, capColor, stem, stemColor, hymenium, hymeniumColor, sporeColor, ecology, substrate, growthPattern, pictureURL, User.Identity.GetUserId());

            DAL.AddUserMushroom(userDescription, address, mushroomID, pictureURL, User.Identity.GetUserName(), User.Identity.GetUserId());

            return(RedirectToAction("IdentifyMushrooms"));
        }