Example #1
0
        public JsonResult <object> DeleteUserbyId([FromBody] JObject json)
        {
            Allstd UserId = JsonConvert.DeserializeObject <Allstd>(json.ToString());
            var    obj    = new object();
            Dictionary <string, object> dic = new Dictionary <string, object>();
            int DeleteId = Convert.ToInt32(UserId.StudentId);

            try
            {
                using (StudentsEntities context = new StudentsEntities())
                {
                    int Deleteduser = context.DeletebyId(DeleteId);
                    if (Deleteduser >= 1)
                    {
                        dic.Add("Message", "Deleted Successfully.");
                        dic.Add("Status", "1");
                    }
                    else
                    {
                        dic.Add("Message", "No Data available");
                        dic.Add("Status", "2");
                    }
                }
            }
            catch (Exception E)
            {
                dic.Add("Message", E.Message);
                dic.Add("Status", "0");
            }
            obj = dic;
            return(Json(obj));
        }