Exemplo n.º 1
0
 public JsonResult AddUser(User_Property objUserProp)
 {
     if (ModelState.IsValid)
     {
         if (objUserProp.ID <= 0 || objUserProp.ID == null)
         {
             objUserProp.Status      = "Active";
             objUserProp.Active      = 1;
             objUserProp.Operated_By = SessionManager.CurrentUser.ID;
             objUserBll = new User_BLL(objUserProp);
             DataTable d = objUserBll.CheckUserExistance();
             if (d.Rows.Count > 0)
             {
                 return(Json(new { success = false, statuscode = 501, msg = "Failed" }, JsonRequestBehavior.AllowGet));
             }
             var flag = objUserBll.Insert();
             if (flag)
             {
                 return(Json(new { success = true, statuscode = 200, msg = "Successfully inserted" }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { success = false, statuscode = 500, msg = "Failed" }, JsonRequestBehavior.AllowGet));
             }
         }
         else
         {
             //objClientBLL = new Client_BLL(objClientProp);
             //var flag = objClientBLL.Update();
             //if (flag)
             //{
             //    return Json(new { success = true, statuscode = 200, msg = "Successfully inserted" }, JsonRequestBehavior.AllowGet);
             //}
             //else
             //{
             //    return Json(new { success = false, statuscode = 500, msg = "Failed" }, JsonRequestBehavior.AllowGet);
             //}
             return(Json(new { success = false, statuscode = 500, msg = "Failed" }, JsonRequestBehavior.AllowGet));
         }
     }
     else
     {
         return(Json(new { success = false, statuscode = 500, msg = "Please Enter According To Instructions" }, JsonRequestBehavior.AllowGet));
     }
 }