Example #1
0
 // GET: LDZ
 public ActionResult LDZLogin()
 {
     try
     {
         LDZUser lDZUser = new LDZUser();
         return(View(lDZUser));
     }
     catch (CmsExceptions ex)
     {
         throw ex;
     }
 }
Example #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;
     }
 }
Example #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;
     }
 }
Example #5
0
 public static bool LDZLogin(LDZUser lDZUser)
 {
     return(CmsDAL.LDZUser(lDZUser));
 }