public ActionResult EditUserLvl([Bind(Include = "UserId, Level, LvlWriting, LvlListening, LvlReading")] User user)
        {
            var u = db.User.Find(user.UserId);

            u.Level           = user.Level;
            u.LvlListening    = user.LvlListening;
            u.LvlReading      = user.LvlReading;
            u.LvlWriting      = user.LvlWriting;
            db.Entry(u).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public string EditTask(ELTask eLTask, HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         eLTask = EditTaskData(eLTask, file);
         db.Entry(eLTask).State = EntityState.Modified;
         try
         {
             db.SaveChanges();
         }
         catch { }
     }
     return(eLTask.Name);
 }
Пример #3
0
 public ActionResult Create([Bind(Include = "WordId,Word1,Translate,GroupId,PartOfSpeech,Transcription,Synonyms")] Word word)
 {
     ViewBag.Group = word.GroupId;
     if (ModelState.IsValid)
     {
         word = UploadVoice(word);
         var group = db.Group.Find(word.GroupId);
         group.WordsCount      = group.WordsCount + 1;
         db.Entry(group).State = EntityState.Modified;
         db.Word.Add(word);
         db.SaveChanges();
         return(RedirectToAction("Index", new { GroupId = word.GroupId }));
     }
     return(View(word));
 }
 public ActionResult Edit([Bind(Include = "TextId,AuthorId,Name,Text,Words,Difficult")] TextTask textTask)
 {
     if (ModelState.IsValid)
     {
         db.Entry(textTask).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(textTask));
 }
Пример #5
0
 public ActionResult Edit([Bind(Include = "Id,VideoHtml,Genre,Type,Name,AuthorLink,UserId,Difficult,Order")] Video video)
 {
     if (ModelState.IsValid)
     {
         db.Entry(video).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(video));
 }
 public ActionResult Edit([Bind(Include = "GroupId,Name,Difficult,ParentId")] GrammarGroup grammarGroup)
 {
     if (ModelState.IsValid)
     {
         db.Entry(grammarGroup).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ParentId = new SelectList(db.GrammarGroup, "GroupId", "Name", grammarGroup.ParentId);
     return(View(grammarGroup));
 }
 public ActionResult Edit([Bind(Include = "QuestionId,TestId,QuestText")] Question question)
 {
     if (ModelState.IsValid)
     {
         db.Entry(question).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TestId = new SelectList(db.Test, "TestId", "Name", question.TestId);
     return(View(question));
 }
 public ActionResult Edit([Bind(Include = "AnswerId,QuestionId,AnswerText,Rightness")] Answer answer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(answer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.QuestionId = new SelectList(db.Question, "QuestionId", "QuestText", answer.QuestionId);
     return(View(answer));
 }
 public ActionResult Edit([Bind(Include = "Id,Voice,Text,Translate,GroupId,AuthorId")] Grammar grammar)
 {
     if (ModelState.IsValid)
     {
         db.Entry(grammar).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GroupId  = new SelectList(db.GrammarGroup.Where(x => x.ParentId != 0), "GroupId", "Name", grammar.GroupId);
     ViewBag.AuthorId = new SelectList(db.User, "UserId", "UserId", grammar.AuthorId);
     return(View(grammar));
 }
Пример #10
0
 public ActionResult Edit([Bind(Include = "GroupId,Name,Difficult,WordsCount,OwnerId,Image")] Group group, HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         if (file != null && file.ContentLength > 0)
         {
             MemoryStream target = new MemoryStream();
             file.InputStream.CopyTo(target);
             group.Image = target.ToArray();
         }
         db.Entry(group).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OwnerId = new SelectList(db.User, "UserId", "UserId", group.OwnerId);
     return(View(group));
 }
 public ActionResult Edit([Bind(Include = "TestId,Voice,Name,OwnerId,Difficult,TaskCount,TestType,Editable,ExportOwner,Time,Text")] Test test, HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         var path = FileOperations.SaveFile(file, Server, pathToSave, extensions);
         if (!string.IsNullOrWhiteSpace(path))
         {
             FileOperations.DeleteIfExist(Server, test.Voice);
             test.Voice = path;
         }
         db.Entry(test).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OwnerId  = new SelectList(db.User, "UserId", "UserId", test.OwnerId);
     ViewBag.TestType = new SelectList(db.TestGroup, "TestGroupId", "Name", test.TestType);
     return(View(test));
 }
 public ActionResult Edit([Bind(Include = "LectionId,Name,OwnerId,LectionType,Description,Editable,ExportOwner,Complexity,ComplexityOrder,LectionPath")] Lection lection, HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         var path = FileOperations.SaveFile(file, Server, pathToSave, extensions);
         if (!string.IsNullOrWhiteSpace(path))
         {
             FileOperations.DeleteIfExist(Server, lection.LectionPath);
             lection.LectionPath = path;
         }
         lection.LectionText     = new byte[] { };
         db.Entry(lection).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OwnerId     = new SelectList(db.User, "UserId", "UserId", lection.OwnerId);
     ViewBag.LectionType = new SelectList(db.LectionGroup, "LectionGroupId", "Name", lection.LectionType);
     return(View(lection));
 }