Exemplo n.º 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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }