示例#1
0
        public ActionResult Create(Label label)
        {
            if (ModelState.IsValid)
            {
                label.Date_Creation = DateTime.Now;

                context.Labels.Add(label);
                context.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(label));
        }
        public ActionResult Create(ProjectType ptype)
        {
            if (ModelState.IsValid)
            {
                ptype.Date_Creation = DateTime.Now;

                context.ProjectTypes.Add(ptype);
                context.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ptype));
        }
示例#3
0
        public ActionResult Create(Genre genre)
        {
            if (ModelState.IsValid)
            {
                genre.Date_Creation = DateTime.Now;

                context.Genres.Add(genre);
                context.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(genre));
        }
示例#4
0
        public ActionResult Create(Client client)
        {
            if (ModelState.IsValid)
            {
                var image = WebImage.GetImageFromRequest("UploadedImage");

                if (image != null)
                {
                    client.MainImage = Server.MapPath("/Images/Clients/").SaveImage(image);
                }

                client.Date_Creation = DateTime.Now;

                context.Clients.Add(client);
                context.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(client));
        }