Beispiel #1
0
 public IActionResult UpdateMajorById(UpdateMajorDTO major)
 {
     if (_service.UpdateMajorById(major) == false)
     {
         return(BadRequest("Updated Failed !"));
     }
     return(Ok("Updated Successfully !"));
 }
Beispiel #2
0
        public bool UpdateMajorById(UpdateMajorDTO major)
        {
            Major oldMajor = _uow.GetRepository <Major>().Get(major.MajorId);

            if (oldMajor == null)
            {
                return(false);
            }
            _uow.GetRepository <Major>().Update(new Major
            {
                MajorId   = major.MajorId,
                MajorName = major.MajorName,
                CreatedBy = oldMajor.CreatedBy,
                IsDisable = oldMajor.IsDisable
            });
            _uow.Commit();
            return(true);
        }