public bool forgetPassword(User u) { using (var db = new MultiplyingEyesEntities()) { db.Users.Attach(u); db.Entry(u).Property(x => x.Password).IsModified = true; db.SaveChanges(); } return(true); }
public bool saveSurvey(Survey data) { try { data.CreatedOn = DateTime.Now; data.IsActive = true; dbContext.Surveys.Add(data); foreach (var obj in data.SurveyAnswers) { if (obj.Image != string.Empty && obj.ImageExtension != string.Empty) { //extension check missing Guid guid = Guid.NewGuid(); string filename = guid.ToString() + obj.ImageExtension; obj.ImagePath = filePath + filename; byte[] imgByteArray = Convert.FromBase64String(obj.Image); //using (MemoryStream ms = new MemoryStream(Convert.FromBase64String(order.IMAGE))) //{ // using (Bitmap bm2 = new Bitmap(ms)) // { // bm2.Save(filePath + "ImageName.jpg"); // } //} File.WriteAllBytes(obj.ImagePath, imgByteArray); //obj.ImagePath = mobileImagePath + filename; obj.ImagePath = "../Assets/Images/" + filename; } } dbContext.SaveChanges(); return(true); } catch (Exception ex) { throw ex; } }
public User signUp(User u) { u.CreatedOn = DateTime.Now; u.IsActive = true; u.UserTypeId = 2; dbContext.Users.Add(u); dbContext.SaveChanges(); return(u); }