Example #1
0
        public IHttpActionResult DeleteTherapistCalender(TherapistCalender model)
        {
            try
            {
                var UserId  = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.NameIdentifier)).Value;
                var RefType = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Name)).Value;
                var RefID   = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Sid)).Value;


                TherapistCalender deptDelete = entities.TherapistCalenders.Find(model.TherapistCalenderID);
                entities.TherapistCalenders.Remove(deptDelete);
                entities.SaveChanges();

                ResponseData responseData = new ResponseData();

                responseData.success = true;
                responseData.message = "Record delete successfully";
                responseData.code    = 200;



                return(Ok(model));
            }
            catch (Exception ex)
            {
                responseData.message = ex.Message != null?ex.Message.ToString() : "server error";

                return(Ok(responseData));
            }
        }
Example #2
0
        public IHttpActionResult SaveTherapistCalender(TherapistCalender model)
        {
            try
            {
                RegisterDL obj     = new RegisterDL();
                var        RefType = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Name)).Value;

                var UserId = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.NameIdentifier)).Value;

                var RefID = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Sid)).Value;

                TherapistCalender tc = new TherapistCalender();
                tc.Day         = model.Day;
                tc.EnteredOn   = DateTime.Now;
                tc.FromTime    = model.FromTime;
                tc.ToTime      = model.ToTime;
                tc.TherapistID = Convert.ToInt32(RefID);
                entities.TherapistCalenders.Add(tc);
                entities.SaveChanges();

                responseData.success = true;
                responseData.message = "Save calender successfully.";
                return(Ok(responseData));
            }
            catch (Exception ex)
            {
                responseData.success = false;
                responseData.message = ex.Message != null?ex.Message.ToString() : "server error";

                return(Ok(responseData));
            }
        }