public ActionResult ChangePassword(FormCollection collection) { if (!IsValidUser(tokens => tokens[1] == Request["username"].ToString())) { return(RedirectToAction("Logon")); } DirectSchoolClientClient cc = new DirectSchoolClientClient(); DirectSchoolClient client = cc.GetByRowKey(AuthTokens[3]); if (client == null) { return(RedirectToAction("Logon")); } if (collection["newpassword"].Trim() == collection["confirmpassword"].Trim()) { client.Password = collection["newpassword"].Trim(); cc.Update(client); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index", new { PasswordError = "Password does not match confirmation" })); } }
public ActionResult Edit(string id, DirectSchoolClient item) { try { DirectSchoolClientClient dscc = new DirectSchoolClientClient(); dscc.Update(item); //Save LeadCap LeadCapClient leadcapclient = new LeadCapClient(); LeadCap leadcap = leadcapclient.GetByRowKey(item.RowKey); bool createnewcap = false; if (leadcap == null) { leadcap = new LeadCap(); leadcap.RowKey = item.RowKey; createnewcap = true; } leadcap.Total = item.TotalCap; leadcap.Annually = item.AnnualCap; leadcap.Monthly = item.MonthlyCap; leadcap.Weekly = item.WeeklyCap; leadcap.Daily = item.DailyCap; if (createnewcap) { leadcapclient.AddNewItem(leadcap); } else { leadcapclient.Update(leadcap); } //Create LeadCounter if doesn't exist LeadCounterClient leadcounterclient = new LeadCounterClient(); LeadCounter leadcounter = leadcounterclient.GetByRowKey(item.RowKey); if (leadcounter == null) { leadcounter = new LeadCounter(); leadcounter.RowKey = item.RowKey; leadcounter.Total = 0; leadcounter.Annually = 0; leadcounter.Monthly = 0; leadcounter.Weekly = 0; leadcounter.Daily = 0; leadcounterclient.AddNewItem(leadcounter); } return(RedirectToAction("Index")); } catch { return(View()); } }