public void AddSpecialty(SpecialtiesViewModel _specialty) { SpecialtiesEntity specialty = new SpecialtiesEntity(); specialty.Id = _specialty.Id; specialty.Name = _specialty.Name; new SpecialtiesRepository().Insert(specialty); }
public SpecialtiesViewModel ReadOneSpecialty(int _id) { SpecialtiesEntity specialty = new SpecialtiesRepository().ReadOneById(_id); SpecialtiesViewModel specialty_vm = new SpecialtiesViewModel(); specialty_vm.Id = specialty.Id; specialty_vm.Name = specialty.Name; return(specialty_vm); }
public SpecialtiesViewModel UpdateSpecialty(SpecialtiesViewModel _specialty) { SpecialtiesEntity upd_specialty = new SpecialtiesEntity() { Id = _specialty.Id, Name = _specialty.Name }; new SpecialtiesRepository().Update(upd_specialty.Id, upd_specialty); return(this.ReadOneSpecialty(_specialty.Id)); }
public IActionResult Edit(SpecialtiesViewModel specialty) { _specialtiesManager.UpdateSpecialty(specialty); return(RedirectToAction("Index")); }
public ViewResult Edit(int?_id) { SpecialtiesViewModel specialty = _specialtiesManager.ReadOneSpecialty((int)_id); return(View(specialty)); }
public IActionResult Create(SpecialtiesViewModel specialty) { _specialtiesManager.AddSpecialty(specialty); return(RedirectToAction("Index")); }
public IActionResult Delete(SpecialtiesViewModel specialty) { new SpecialtiesManager().DeleteSpecialty(specialty.Id); return(RedirectToAction("Index")); }