public IHttpActionResult PutDocument(int id, Document document)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            db.Entry(document).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DocumentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
 public void Update(DOCUS_ASM_ASSIGNMENTS assignmentRequest)
 {
     try
     {
         _context.Entry(assignmentRequest).State = EntityState.Modified;
         _context.SaveChanges();
     }
     catch (DbEntityValidationException e)
     {
         foreach (var eve in e.EntityValidationErrors)
         {
             Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                               eve.Entry.Entity.GetType().Name, eve.Entry.State);
             foreach (var ve in eve.ValidationErrors)
             {
                 Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                   ve.PropertyName, ve.ErrorMessage);
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Esempio n. 3
0
        public async Task <IActionResult> PutDocument(int id, Document document)
        {
            if (id != document.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 4
0
        public void DeleteDocument(int id)
        {
            var document = DocumentDB.Documents.Include(s => s.DS.Statuses).FirstOrDefault(d => d.DocumentId == id);

            DocumentDB.Entry(document).State = EntityState.Modified;
            document.DS.Statuses.Name        = "DELETED";
        }
Esempio n. 5
0
 public void Delete(int userId)
 {
     using (DocumentContext db = new DocumentContext())
     {
         User userToDelete = db.Users.Find(userId);
         db.Entry(userToDelete).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
 public void Delete(int registerId)
 {
     using (DocumentContext db = new DocumentContext())
     {
         Client clientToDelete = db.Clients.Find(registerId);
         db.Entry(clientToDelete).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Esempio n. 7
0
 public ActionResult Edit([Bind(Include = "DocumentID,Title,Author,Content")] Document document)
 {
     if (ModelState.IsValid)
     {
         db.Entry(document).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(document));
 }
 public bool UpdateDocumentStatus(DocumentStatus doc)
 {
     try
     {
         _dbContext.Entry(doc).State = EntityState.Modified;
         Save();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 9
0
 public void Update(DOCUS_ASM_LOOKUP_RECORDING_STATUS recordingStatusData)
 {
     _context.Entry(recordingStatusData).State = EntityState.Modified;
     _context.SaveChanges();
 }
 public void Update(DOCUS_ASM_LOOKUP_PROCESSED_BY processedByData)
 {
     _context.Entry(processedByData).State = EntityState.Modified;
     _context.SaveChanges();
 }
 public void Update(DOCUS_SUB_LOOKUP_FEE feeData)
 {
     _context.Entry(feeData).State = EntityState.Modified;
     _context.SaveChanges();
 }
 public void Update(DOCUS_ASM_LOOKUP_ENTERED_BY enteredByData)
 {
     _context.Entry(enteredByData).State = EntityState.Modified;
     _context.SaveChanges();
 }
Esempio n. 13
0
 public void Update(DOCUS_ASM_LOOKUP_ASSIGNED_TO assignedToData)
 {
     _context.Entry(assignedToData).State = EntityState.Modified;
     _context.SaveChanges();
 }
Esempio n. 14
0
 public void Update(DOCUS_ASM_LOOKUP_PROCESSOR_NAME processorNameData)
 {
     _context.Entry(processorNameData).State = EntityState.Modified;
     _context.SaveChanges();
 }
Esempio n. 15
0
 public void Update(Document Doc)
 {
     db.Entry(Doc).State = EntityState.Modified;
 }
 public void Update(DOCUS_ASM_LOOKUP_STATUS assignmentStatus)
 {
     _context.Entry(assignmentStatus).State = EntityState.Modified;
     _context.SaveChanges();
 }
 public void Update(DOCUS_SUB_REQUEST subRequest)
 {
     _context.Entry(subRequest).State = EntityState.Modified;
     _context.SaveChanges();
 }
Esempio n. 18
0
 public void Update(DOCUS_ASM_LOOKUP_REQUEST_TYPE requestTypeData)
 {
     _context.Entry(requestTypeData).State = EntityState.Modified;
     _context.SaveChanges();
 }
 public void Update(DOCUS_SUB_LOOKUP_LOAN_TYPE loanTypeData)
 {
     _context.Entry(loanTypeData).State = EntityState.Modified;
     _context.SaveChanges();
 }
 public void Update(DOCUS_SYS_CUSTODIAN subRequest)
 {
     _context.Entry(subRequest).State = EntityState.Modified;
     _context.SaveChanges();
 }
 public void Update(DOCUS_ASM_LOOKUP_REQUEST_REASON requestReasonData)
 {
     _context.Entry(requestReasonData).State = EntityState.Modified;
     _context.SaveChanges();
 }
Esempio n. 22
0
 public void Update(DOCUS_SUB_LOOKUP_REPRESENTATIVE representativeData)
 {
     _context.Entry(representativeData).State = EntityState.Modified;
     _context.SaveChanges();
 }
 public void Update(DOCUS_ASM_LOOKUP_DOC_TYPE docTypeData)
 {
     _context.Entry(docTypeData).State = EntityState.Modified;
     _context.SaveChanges();
 }