Esempio n. 1
0
 public ActionResult Add(AddWorkshopServiceViewModel model)
 {
     if (ModelState.IsValid)
     {
         workshopServicesRepository.Add(model);
         return(RedirectToAction("List"));
     }
     return(View(model));
 }
Esempio n. 2
0
        public void Update(AddWorkshopServiceViewModel model)
        {
            WorkshopServices CurrentService = db.WorkshopServices.SingleOrDefault(x => x.WorkshopServicesID == model.WorkshopServicesID);

            CurrentService.ImageURL        = model.ImageURL;
            CurrentService.Title           = model.Title;
            CurrentService.Description     = model.Description;
            db.Entry(CurrentService).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
Esempio n. 3
0
        public void Add(AddWorkshopServiceViewModel model)
        {
            WorkshopServices NewService = new WorkshopServices()
            {
                ImageURL    = model.ImageURL,
                Title       = model.Title,
                Description = model.Description
            };

            db.WorkshopServices.Add(NewService);
            db.SaveChanges();
        }
Esempio n. 4
0
        public AddWorkshopServiceViewModel GetByID(int id)
        {
            WorkshopServices            CurrentService = db.WorkshopServices.SingleOrDefault(x => x.WorkshopServicesID == id);
            AddWorkshopServiceViewModel NewModel       = new AddWorkshopServiceViewModel()
            {
                WorkshopServicesID = CurrentService.WorkshopServicesID,
                Title       = CurrentService.Title,
                ImageURL    = CurrentService.ImageURL,
                Description = CurrentService.Description
            };

            return(NewModel);
        }
Esempio n. 5
0
 public ActionResult Update(AddWorkshopServiceViewModel model)
 {
     workshopServicesRepository.Update(model);
     return(RedirectToAction("List"));
 }