Ejemplo n.º 1
0
        public ActionResult Add([FromBody] ClsDersDetay newdata)
        {
            if (newdata == null)
            {
                return(Ok(_ControllersHelper.notfound("data is null")));
            }

            _appRepository.Add(newdata); ////////////////////////////////////////

            if (_appRepository.SaveAll())
            {
                return(Ok(newdata));
            }
            else
            {
                return(BadRequest("başarısız?!"));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Update(ClsDers id, [FromBody] ClsDersDetay newdata)
        {
            var olddata = _appRepository.GetDersDetayById(id);

            if (olddata == null)
            {
                return(Ok(_ControllersHelper.notfound(info: id)));
            }

            // _ControllersHelper.PrepareUpdate(typeof(ClsDersDetay), olddata, newdata);
            _ControllersHelper.PrepareUpdate(newdata.GetType(), olddata, newdata);
            // ikiside olur

            _appRepository.Update(olddata); ////////////////////////////////////////

            if (_appRepository.SaveAll())
            {
                return(Ok(olddata));
            }
            else
            {
                return(BadRequest(id + " başarısız?!"));
            }
        }