예제 #1
0
        public IHttpActionResult PostTermsOfUse(TermsofUse TermsOfUse)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _repo.UpsertTermsOfUse(TermsOfUse);

            return(CreatedAtRoute("DefaultApi", new { id = TermsOfUse.Id }, TermsOfUse));
        }
예제 #2
0
        public IHttpActionResult GetTermsOfUse(string id)
        {
            TermsofUse TermsOfUse = _repo.GetTermsOfUse(id);

            if (TermsOfUse == null)
            {
                return(NotFound());
            }

            return(Ok(TermsOfUse));
        }
        public ActionResult Index(TermsofUse termsofuse)
        {
            if (ModelState.IsValid)
            {
                db = new StorehouseDBContext();

                db.Entry(termsofuse).State = EntityState.Modified;
                db.SaveChanges();
            }
            return(RedirectToAction("Index", "TermsofUse"));
        }
예제 #4
0
        public IHttpActionResult PutTermsOfUse(string id, TermsofUse TermsOfUse)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (new Guid(id) != TermsOfUse.Id)
            {
                return(BadRequest());
            }

            _repo.UpsertTermsOfUse(TermsOfUse);

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #5
0
 public void UpsertTermsOfUse(TermsofUse input)
 {
     try
     {
         if (input.Id == null)
         {
             input.Id = Guid.NewGuid();
             db.TermsofUse.Add(input);
             db.SaveChanges();
         }
         else
         {
             db.Entry(input).State = EntityState.Modified;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }