public IActionResult Save(MuseumTypes type)
        {
            if (!ModelState.IsValid)
            {
                return(View("Add", type));
            }
            museumtypeRepository.InsertMuseumType(type);
            museumtypeRepository.Save();

            return(RedirectToAction("Index"));
        }
        public IActionResult Edit(MuseumTypes type)
        {
            if (!ModelState.IsValid)
            {
                return(View("Edit", type));
            }
            museumtypeRepository.UpdateMuseumType(type);
            museumtypeRepository.Save();

            return(RedirectToAction("Index"));
        }
Пример #3
0
        public void DeleteMuseumType(int typeId)
        {
            MuseumTypes type = context.MuseumTypes.Find(typeId);

            context.MuseumTypes.Remove(type);
        }
Пример #4
0
 public void UpdateMuseumType(MuseumTypes type)
 {
     context.Entry(type).State = EntityState.Modified;
 }
Пример #5
0
 public void InsertMuseumType(MuseumTypes type)
 {
     context.MuseumTypes.Add(type);
 }
        public IActionResult Add()
        {
            MuseumTypes model = new MuseumTypes();

            return(View(model));
        }
        public IActionResult GetType(int id)
        {
            MuseumTypes model = museumtypeRepository.GetMuseumType(id);

            return(View("Edit", model));
        }