Exemplo n.º 1
0
        public HttpResponseMessage SaveRole(SaveRoleDTO obj)
        {
            HttpResponseMessage message;

            try
            {
                RoleDAL dal    = new RoleDAL();
                var     dynobj = new { result = dal.SaveRole(obj) };
                message = Request.CreateResponse(HttpStatusCode.OK, dynobj);
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "something Wrong.Try Again!" });
            }
            return(message);
        }
Exemplo n.º 2
0
        public bool SaveRole(SaveRoleDTO obj)
        {
            bool res = false;

            obj.CreatedBy = "1001";
            SqlCommand cmd = new SqlCommand("sp_SaveRole");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@p_Name", obj.Name);
            cmd.Parameters.AddWithValue("@p_Code", obj.Code);
            cmd.Parameters.AddWithValue("@p_ActionBy", obj.CreatedBy);
            int result = new DBlayer().ExecuteNonQuery(cmd);

            if (result != Int32.MaxValue)
            {
                res = true;
            }
            return(res);
        }