예제 #1
0
        private BaseResponse deleteApplicationUser(string userId)
        {
            BaseResponse baseResponse = new BaseResponse();

            using (dbLawCMSEntities db = new dbLawCMSEntities())
            {
                var data = db.AspNetUsers.Where(x => x.Id == userId).FirstOrDefault();
                if (data != null)
                {
                    data.Active          = false;
                    db.Entry(data).State = EntityState.Modified;
                    int Result = db.SaveChanges();
                    if (Result > 0)
                    {
                        baseResponse.Success = true;
                    }
                    else
                    {
                        baseResponse.Success = false;
                        baseResponse.Message = "User not deleted";
                    }
                }
                else
                {
                    baseResponse.Success = false;
                    baseResponse.Message = "User not found";
                }
            }
            return(baseResponse);
        }
        public ActionResult CreateCase(AddCaseViewModel addCaseViewModel)
        {
            BaseResponse baseResponse = new BaseResponse();

            using (dbLawCMSEntities db = new dbLawCMSEntities())
            {
                db.tbl_Case.Add(addCaseViewModel.Case);

                db.tbl_Client.Add(addCaseViewModel.Client);

                db.tbl_Case_Attachments.Add(addCaseViewModel.Attachments);

                db.tbl_Case_Notes.Add(addCaseViewModel.Notes);

                db.SaveChanges();
            }

            return(new JsonResult {
                Data = baseResponse, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }