Beispiel #1
0
        public virtual T Update(T t, object key)
        {
            if (t == null)
            {
                return(null);
            }
            T exist = _context.Set <T>().Find(key);

            if (exist != null)
            {
                _context.Entry(exist).CurrentValues.SetValues(t);
                //_context.SaveChanges();
            }
            return(exist);
        }
        public async Task <IActionResult> PutAmendmentReason([FromRoute] int id, [FromBody] AmendmentReason amendmentReason)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != amendmentReason.ID)
            {
                return(BadRequest());
            }

            _context.Entry(amendmentReason).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AmendmentReasonExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #3
0
 public void DeleteRegisteredSubjectEntity(RegisteredSubjectEntity registeredSubjectEntityToDelete)
 {
     using (var db = new PlutoContext())
     {
         db.Entry(registeredSubjectEntityToDelete).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Beispiel #4
0
 public void DeleteSubjectEntity(SubjectEntity subjectEntityToDelete)
 {
     using (var db = new PlutoContext())
     {
         db.Entry(subjectEntityToDelete).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Beispiel #5
0
 public void UpdateSubjectEntity(SubjectEntity subjectEntityToUpdate)
 {
     using (var db = new PlutoContext())
     {
         db.Entry(subjectEntityToUpdate).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Beispiel #6
0
 public void DeleteTermEntity(TermEntity termEntityToDelete)
 {
     using (var db = new PlutoContext())
     {
         db.Entry(termEntityToDelete).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Beispiel #7
0
 public void UpdateTermEntity(TermEntity termEntityToUpdate)
 {
     using (var db = new PlutoContext())
     {
         db.Entry(termEntityToUpdate).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
 public void DeleteAttendanceEntity(AttendanceEntity attendanceEntityToDelete)
 {
     using (var db = new PlutoContext())
     {
         db.Entry(attendanceEntityToDelete).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Beispiel #9
0
 public void Update(T entity)
 {
     _context.Entry(entity).State = EntityState.Modified;
     //Save();
 }