示例#1
0
 // GET: LDZ
 public ActionResult LDZLogin()
 {
     try
     {
         LDZUser lDZUser = new LDZUser();
         return(View(lDZUser));
     }
     catch (CmsExceptions ex)
     {
         throw ex;
     }
 }
示例#2
0
        public ActionResult LDZLogin(LDZUser lDZUser)
        {
            string apiLink = ConfigurationManager.AppSettings["ApiUrl"];

            using (var client = new HttpClient())
            {
                FormsAuthentication.SetAuthCookie(lDZUser.EmailId, false);
                client.BaseAddress = new Uri(apiLink);
                var postTask = client.PostAsJsonAsync("LDZLogin", lDZUser);
                postTask.Wait();
                var result = postTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    return(RedirectToAction(nameof(LDZHome)));
                }
            }
            return(View(lDZUser));
        }
 public IHttpActionResult Post([FromBody] LDZUser lDZUser)
 {
     try
     {
         bool isLogged = CmsBL.LDZLogin(lDZUser);
         if (isLogged)
         {
             return(Created("user", lDZUser));
         }
         else
         {
             return(StatusCode(HttpStatusCode.InternalServerError));
         }
     }
     catch (CmsExceptions ex)
     {
         throw ex;
     }
 }
示例#4
0
 public static bool LDZUser(LDZUser lDZUser)
 {
     try
     {
         using (CMSDBContext context = new CMSDBContext())
         {
             var login = context.LDZUsers.Where(u => u.EmailId == lDZUser.EmailId && u.Password == lDZUser.Password).FirstOrDefault();
             if (login == null)
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
             //return login;
         }
     }
     catch (CmsExceptions ex)
     {
         throw ex;
     }
 }
示例#5
0
文件: CmsBL.cs 项目: sushma-sys/CMS
 public static bool LDZLogin(LDZUser lDZUser)
 {
     return(CmsDAL.LDZUser(lDZUser));
 }