Exemplo n.º 1
0
 public IHttpActionResult Put(service service)
 {
     bool isUpdated = serviceService.UpdateService(service.servid, service);
     if (isUpdated == true)
         return Ok();
     return BadRequest();
 }
Exemplo n.º 2
0
 public IHttpActionResult Post(service service)
 {
     bool isSave = serviceService.SaveService(service);
     if (isSave == true)
         return Ok();
     return BadRequest();
 }
Exemplo n.º 3
0
        public bool UpdateService(long servid, service service)
        {
            try
            {
                db.Entry(service).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }

        }
Exemplo n.º 4
0
        public bool SaveService(service service)
        {
            try
            {
                db.service.Add(service);
                db.SaveChanges();
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }

        }