コード例 #1
0
ファイル: Notes.cs プロジェクト: ramazanbozkir/webde-not
 public static string NoteUpdate(NoteViews note)
 {
     try
     {
         using (WebdeNotEntities db = new WebdeNotEntities())
         {
             TblNote upnote = db.TblNote.Find(note.ID);
             if (upnote != null)
             {
                 upnote.Title            = note.Title;
                 upnote.Description      = note.Description;
                 upnote.ReminderDate     = note.ReminderDate;
                 upnote.İmportantyDegree = note.İmportantyDegree;
                 db.SaveChanges();
                 return("+ note guncellendi.");
             }
             else
             {
                 return("- note bulunamadi.");
             }
         }
     }
     catch (Exception ex)
     {
         return("- " + ex.Message);
     }
 }
コード例 #2
0
        public ActionResult Note(List <TblNote> note)
        {
            using (DatabaseModels db = new DatabaseModels())
            {
                connection.ConnectionString = cParameter.cnnstring;

                command.Connection = connection;
                int userID = cParameter.userID;
                command.CommandText = "select * from  TblNote where REF_TblUser='******' ";
                connection.Open();
                SqlDataReader sdr = command.ExecuteReader();



                List <TblNote> objModel = new List <TblNote>();

                if (sdr.HasRows)
                {
                    while (sdr.Read())
                    {
                        var details = new TblNote();
                        details.Title        = sdr["Title"].ToString();
                        details.Description  = sdr["Description"].ToString();
                        details.CreationTime = (DateTime)sdr["CreationTime"];
                        details.ID           = Convert.ToInt32(sdr["ID"]);
                        objModel.Add(details);
                    }
                    note = objModel;

                    connection.Close();
                }
                return(View("Note", note));
            }
        }
コード例 #3
0
        public ActionResult Index(TblNote note)
        {
            connection.ConnectionString = cParameter.cnnstring;
            command.Connection          = connection;
            command.CommandType         = System.Data.CommandType.Text;
            command.CommandText         = "insert into TblNote (Title, Description, CreationTime, REF_TblUser) Values ('" + note.Title + "','" + note.Description + "' ,'" + DateTime.Now.ToString("MM/dd/yyyy") + "','" + userID + "' )";

            command.Connection = connection;

            connection.Open();
            command.ExecuteNonQuery();
            connection.Close();

            ViewBag.Message = "Saved Successfully.";

            return(View("Index", new TblNote()));
        }
コード例 #4
0
ファイル: Notes.cs プロジェクト: ramazanbozkir/webde-not
 public static string NoteAdd(NoteViews newnote)
 {
     try
     {
         using (WebdeNotEntities db = new WebdeNotEntities())
         {
             TblNote new_note = new TblNote
             {
                 Title            = newnote.Title,
                 Description      = newnote.Description,
                 ReminderDate     = newnote.ReminderDate,
                 İmportantyDegree = newnote.İmportantyDegree,
             };
             db.TblNote.Add(new_note);
             db.SaveChanges();
             return("+ Note eklendi");
         }
     }
     catch (Exception ex)
     {
         return("- " + ex.Message);
     }
 }
コード例 #5
0
ファイル: Notes.cs プロジェクト: ramazanbozkir/webde-not
 public static string DeleteNote(int noteID)
 {
     try
     {
         using (WebdeNotEntities db = new WebdeNotEntities())
         {
             TblNote delnote = db.TblNote.Find(noteID);
             if (delnote != null)
             {
                 delnote.Existing = false;
                 return("+ Silindi.");
             }
             else
             {
                 return("- not bulunamadı.");
             }
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         return("- " + ex.Message);
     }
 }