示例#1
0
        public dynamic Deactivate(dynamic myUser)
        {
            db.Configuration.ProxyCreationEnabled = false;
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            CLIENT          client     = new CLIENT();
            DEACTIVATEDUSER deactivate = new DEACTIVATEDUSER();

            try
            {
                deactivate.DEACTIVATE_REASON   = myUser.Reason;
                deactivate.DEACTIVATE_DATETIME = DateTime.Now;
                deactivate.USERID = Convert.ToInt16(myUser.UserID);

                db.DEACTIVATEDUSERs.Add(deactivate);
                db.SaveChanges();
            }
            catch (Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Error With updating details"));
            }

            return(Request.CreateResponse(HttpStatusCode.Created));
        }
示例#2
0
        public dynamic Deactivate(dynamic myUser)
        {
            db.Configuration.ProxyCreationEnabled = false;
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            CLIENT          client     = new CLIENT();
            DEACTIVATEDUSER deactivate = new DEACTIVATEDUSER();

            try
            {
                deactivate.DEACTIVATE_REASON   = myUser.Reason;
                deactivate.DEACTIVATE_DATETIME = DateTime.Now;
                deactivate.USERID = Convert.ToInt16(myUser.UserID);

                db.DEACTIVATEDUSERs.Add(deactivate);
                db.SaveChanges();
            }
            catch (Exception e)
            {
                return(false);
            }

            return(true);
        }