public ActionResult EditTask(EditTaskRequest editTaskRequest) { var user = Session["user"] as User; using (var db = new DbConnectionDataContext()) { var task = db.Tasks.SingleOrDefault(t => t.ID == editTaskRequest.TaskId); task.IsDone = editTaskRequest.IsDone; db.SubmitChanges(); } return(new EmptyResult()); }
public ActionResult DeleteNote(int id) { var user = Session["user"] as User; using (var db = new DbConnectionDataContext()) { var note = db.Notes.SingleOrDefault(t => t.ID == id); db.Notes.DeleteOnSubmit(note); db.SubmitChanges(); } return(new EmptyResult()); }
public ActionResult AddNote(AddNoteRequest addNoteRequest) { var user = Session["user"] as User; Note note; using (var db = new DbConnectionDataContext()) { note = new Note { Description = addNoteRequest.Description, UserId = user.ID, }; db.Notes.InsertOnSubmit(note); db.SubmitChanges(); } return(Json(new { id = note.ID })); }
public ActionResult AddTask(AddTaskRequest addTaskRequest) { var user = Session["user"] as User; Task task; using (var db = new DbConnectionDataContext()) { task = new Task { IsDone = false, ProjectId = null, Description = addTaskRequest.Description, UserId = user.ID }; db.Tasks.InsertOnSubmit(task); db.SubmitChanges(); } return(Json(new { id = task.ID })); }
public ActionResult Registration(RegistrationViewModel registrationViewModel) { if (string.IsNullOrEmpty(registrationViewModel.Name) || string.IsNullOrEmpty(registrationViewModel.Lastname) || string.IsNullOrEmpty(registrationViewModel.Username) || string.IsNullOrEmpty(registrationViewModel.Password) || string.IsNullOrEmpty(registrationViewModel.RepeatPassword)) { ViewBag.error = "შეავსე ყველა ველი"; return(View()); } if (registrationViewModel.Password != registrationViewModel.RepeatPassword) { ViewBag.error = "პაროლები არ ემთხვევა"; return(View()); } // კონფირმაციის გასვლამდე გავლილი რეგისტრაცია var notConfirmedUser = new User() { Username = registrationViewModel.Username, Name = registrationViewModel.Name, Lastname = registrationViewModel.Lastname, CreateDate = DateTime.Now, PasswordHash = AccountHelper.GetHash256ByString(registrationViewModel.Password + AccountHelper.AuthSecret), }; using (var db = new DbConnectionDataContext()) { db.Users.InsertOnSubmit(notConfirmedUser); db.SubmitChanges(); } return(RedirectToAction("Login")); }