public ActionResult SaveChild(FormCollection coll) { try { BLL.LearnHebrewEntities.Child child = new BLL.LearnHebrewEntities.Child(); var name = coll["ChildName"]; var color = coll["ChildColor"]; if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(color)) { child.Name = name; child.Color = color; child.Password = "******"; var childID = BLL.Services.ChildServices.Save(child); child.Password = childID.ToString(); } return(Content("save successful")); //return View("ChildPassword",child.Password); } catch (Exception ex) { return(Content("fail")); } }
public string SaveChildProgress(TestResultDto result) { BLL.LearnHebrewEntities.Child child = new BLL.LearnHebrewEntities.Child(); try { child = Auxiliray.Session.ChildInSession; if (child == null)// the user is not found { return("failed to find child"); } var childProgress = BLL.Services.ChildProgressServices.LoadSpecificChildProgressesByChildID(result.ProgressID); childProgress.Data.Letter = result.GameLetter; childProgress.Data.EndDate = DateTime.Now; if (result.WrongAnswers != null) { for (var i = 0; i < result.WrongAnswers.Length; i++) { childProgress.Data.WrongAnswers.Add(result.CorresponsingContentID[i], result.WrongAnswers[i]); } } var savingProgress = BLL.Services.ChildProgressServices.Save(childProgress); } catch (Exception ex) { return("fail"); } return("OK"); }
public int SaveChild(string Name, string Color) { try { BLL.LearnHebrewEntities.Child child = new BLL.LearnHebrewEntities.Child(); var name = Name; var color = Color; if (name != null && color != null) { child.Name = name; child.Color = color; child.Password = "******"; var childID = BLL.Services.ChildServices.Save(child); child.Password = childID.ToString(); return(int.Parse(child.Password)); } else { return(-1); } } catch (Exception ex) { return(-1); } }
public ActionResult ReturnToIndex() { Models.childModel m = new Models.childModel(); BLL.LearnHebrewEntities.Child child = new BLL.LearnHebrewEntities.Child(); child = Auxiliray.Session.ChildInSession; m.child = child; return(View("~/Views/Child/Index.cshtml", m)); }
public ActionResult LoadChildGuest() { Models.childModel m = new Models.childModel(); try { BLL.LearnHebrewEntities.Child child = new BLL.LearnHebrewEntities.Child(); child.ChildID = -1; child.Name = "אורח"; child.Password = "******"; child.Data = null; Auxiliray.Session.ChildInSession = child; m.child = child; return(View("~/Views/Child/Index.cshtml", m)); } catch (Exception ex) { return(Content("error")); } }
public ActionResult IndexPage(FormCollection coll) { Models.childModel m = new Models.childModel(); Models.messageModel message = new Models.messageModel(); try { var name = coll["childName"]; var password = coll["childPassword"]; BLL.LearnHebrewEntities.Child child = new BLL.LearnHebrewEntities.Child(); if (Auxiliray.Session.ChildInSession != null && Auxiliray.Session.ChildInSession.ChildID == int.Parse(password)) { child = Auxiliray.Session.ChildInSession; } else { child = BLL.Services.ChildServices.LoadChildByNameandPassword(name, password); } if (child != null && child.ChildID != 0) { Auxiliray.Session.ChildInSession = child; m.child = child; return(View("~/Views/Child/Index.cshtml", m)); } else { message.message = "קרתה שגיאה, בבקשה נסו להיכנס לאתר בעזרת כפתור כניסה רשומה שוב"; return(View("~/Views/Login/ChildLogin.cshtml", message)); } } catch (Exception ex) { message.message = "קרתה שגיאה, בבקשה נסו להיכנס לאתר בעזרת כפתור כניסה רשומה שוב"; return(View("~/Views/Login/ChildLogin.cshtml", message)); } }