Exemplo n.º 1
0
        public IActionResult Put(long id, [FromBody] JavabVM javab)
        {
            if (
                !ModelState.IsValid ||
                !_javab.isJavabOfuser(javab.Id, 1) ||
                (javab.Id != id) ||
                (javab == null || id < 1))
            {
                return(BadRequest());
            }
            var q = _javab.EditeJavab(javab);

            if (q)
            {
                return(Ok("*** علی باوامی ***"));
            }
            else
            {
                return(BadRequest());
            }
        }
        public IActionResult Put(long id, [FromBody] JavabVM javab)
        {
            var user = _user.GetCurrentUserId();

            if (
                !ModelState.IsValid ||
                !_javab.isJavabOfuser(javab.Id, user) ||
                (javab.Id != id) ||
                (javab == null || id < 1))
            {
                return(BadRequest());
            }
            var q = _javab.EditeJavab(javab);

            if (q)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }