Esempio n. 1
0
 public int Deleteuser(string FirstName)
 {
     int result = 0;
     using (ROPAEntities context = new ROPAEntities())
     {
         var UserName = (from u in context.UpcmomingSurveyors where u.FirstName == FirstName select new { u.LastName }).FirstOrDefault();
         var deleteQuery = (from u in context.UpcmomingSurveyors where u.FirstName == FirstName select u).FirstOrDefault();
         context.DeleteObject(deleteQuery);
         result=context.SaveChanges();
        return result;
     }
 }
    void Clear()
    {
        txtEmailId.Text = "";
        txtFrstName.Text = "";
        txtLastName.Text = "";
        txtpsswrd.Text = "";
        ddlRoleId.ClearSelection();

        using (ROPAEntities context = new ROPAEntities())
        {
            var deleteQuery = (from u in context.UploadFiles where u.SurApp_Id == null select u).ToList();
            context.DeleteObject(deleteQuery);
            context.SaveChanges();
        }

        ClearSession();
    }