public ActionResult Create(FileLogg filelogg) { if (ModelState.IsValid) { db.fileLoggs.Add(filelogg); db.SaveChanges(); return RedirectToAction("Index"); } return View(filelogg); }
public ActionResult Edit(FileLogg filelogg) { if (ModelState.IsValid) { db.Entry(filelogg).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(filelogg); }
private void updateFileLog(FileLogg fileLog) { FileLogg fileObj = db.fileLoggs.Single(f => f.FileLogId == fileLog.FileLogId); fileObj = fileLog; db.SaveChanges(); }
private FileLogg setFileLogFields(string path, string fileName, int formId) { FileLogg fileLog = new FileLogg(); fileLog.FileName = fileName; fileLog.FilePath = path; fileLog.FileStatusId = 0; fileLog.FormId = formId; return fileLog; }
private bool isFileLogExists(FileLogg file) { bool returnType = false; try { string fName = db.fileLoggs.Single(p => p.FilePath == file.FilePath && p.FileName == file.FileName).FileName; returnType = true; } catch (Exception ex) { } return returnType; }
// private void fnUpdateFileLog(chqBook_FileLog chqbook_filelog) private void fnUpdateFileLog(FileLogg chqbook_filelog) { chqbook_filelog.sysDate = DateTime.Now.ToString(); chqbook_filelog.osyDate = DateTime.Now.ToString(); if (chqbook_filelog.FileLogId == 0) { // db.SaveChanges(); if (!isFileLogExists(chqbook_filelog)) { db.fileLoggs.Add(chqbook_filelog); db.SaveChanges(); } } else { // db.fileLoggs.Add(chqbook_filelog); db.Entry(chqbook_filelog).State = EntityState.Modified; db.SaveChanges(); } }
private void fnUpdateFileLogs(FileLogg fileLog) { db.Entry(fileLog).State = EntityState.Modified; db.SaveChanges(); }
// private void fnUpdateFileLog(chqBook_FileLog chqbook_filelog) private void fnUpdateFileLog(FileLogg chqbook_filelog) { try { if (chqbook_filelog.FileLogId == 0) { // db.SaveChanges(); if (!isFileLogExists(chqbook_filelog)) { db.fileLoggs.Add(chqbook_filelog); db.SaveChanges(); } } else { //This means that the files already has been consumed. if (chqbook_filelog.FormId == 10) { _getVals.LogAudit("", "Update", "", "Update Contact file {" + chqbook_filelog.FilePath + " } on the database since there exists a file with a similar Name", "Update", "System"); chqbook_filelog.FileStatusId = 1; } db.Entry(chqbook_filelog).State = EntityState.Modified; db.SaveChanges(); } } catch (Exception ex) { } }