コード例 #1
0
 public IHttpActionResult Post(Features feature)
 {
     using (AngularContext db = new AngularContext())
     {
         db.Features.Add(feature);
         db.SaveChanges();
     }
     return CreatedAtRoute("DefaultApi", new { Id = feature.FeatureId }, feature);
 }
コード例 #2
0
 public IHttpActionResult Post(Project project)
 {
     using (AngularContext objDemoContext = new AngularContext())
     {
         objDemoContext.Project.Add(project);
         objDemoContext.SaveChanges();
     }
     return CreatedAtRoute("DefaultApi", new { Id = project.Id }, project);
 }
コード例 #3
0
 // POST api/<controller>
 /// <summary>
 /// post task to db
 /// </summary>
 /// <param name="task">From angular controller</param>
 /// <returns></returns>
 public IHttpActionResult Post(Task task)
 {
     using (AngularContext db = new AngularContext())
     {
         db.Tasks.Add(task);
         db.SaveChanges();
     }
     return CreatedAtRoute("DefaultApi", new { Id = task.TaskId }, task);
 }
コード例 #4
0
 public IHttpActionResult Post(Developer developer)
 {
     using (AngularContext objDemoContext = new AngularContext())
     {
         objDemoContext.Developer.Add(developer);
         objDemoContext.SaveChanges();
     }
     return CreatedAtRoute("DefaultApi", new { Id = developer.DeveloperId }, developer);
 }
コード例 #5
0
 public IHttpActionResult Delete(int id)
 {
     using (AngularContext objDemoContext = new AngularContext())
     {
         var getProject = objDemoContext.Project.FirstOrDefault(a => a.Id == id);
         if (getProject != null)
         {
             objDemoContext.Project.Remove(getProject);
             objDemoContext.SaveChanges();
             return Ok();
         }
         return NotFound();
     }
 }
コード例 #6
0
 public IHttpActionResult Delete(int id)
 {
     using (AngularContext db = new AngularContext())
     {
         var getFeatures = db.Features.FirstOrDefault(a => a.FeatureId == id);
         if (getFeatures != null)
         {
             db.Features.Remove(getFeatures);
             db.SaveChanges();
             return Ok();
         }
         return NotFound();
     }
 }
コード例 #7
0
 public IHttpActionResult Delete(int id)
 {
     using (AngularContext objDemoContext = new AngularContext())
     {
         var getEmployee = objDemoContext.Developer.FirstOrDefault(a => a.DeveloperId == id);
         if (getEmployee != null)
         {
             objDemoContext.Developer.Remove(getEmployee);
             objDemoContext.SaveChanges();
             return Ok();
         }
         return NotFound();
     }
 }
コード例 #8
0
 // DELETE api/<controller>/5
 /// <summary>
 /// delete task from db by TaskID
 /// </summary>
 /// <param name="id">From angular controller</param>
 /// <returns></returns>
 public IHttpActionResult Delete(int id)
 {
     using (AngularContext db = new AngularContext())
     {
         var getTask = db.Tasks.FirstOrDefault(a => a.TaskId == id);
         if (getTask != null)
         {
             db.Tasks.Remove(getTask);
             db.SaveChanges();
             return Ok();
         }
         else
         {
             return NotFound();
         }
     }
 }
コード例 #9
0
        public IHttpActionResult Put(int id, Project project)
        {
            if (id != project.Id)
            {
                return BadRequest();
            }
            using (AngularContext contextObj = new AngularContext())
            {

                Project getProject = contextObj.Project.Find(id);
                getProject.Name = project.Name;
                contextObj.SaveChanges();
                return CreatedAtRoute("DefaultApi", new { Id = project.Id }, project);
            }
        }
コード例 #10
0
        public IHttpActionResult Put(int id, Features feature)
        {
            if (id != feature.FeatureId)
            {
                return BadRequest();
            }
            using (AngularContext db = new AngularContext())
            {
                Features getFeatures = db.Features.Find(id);
                getFeatures.FeatureName = feature.FeatureName;
                getFeatures.FeatureDescription = feature.FeatureDescription;
                db.SaveChanges();

                return CreatedAtRoute("DefaultApi", new { Id = feature.FeatureId }, feature);
            }
        }
コード例 #11
0
        // PUT api/<controller>/5
        /// <summary>
        /// put task
        /// </summary>
        /// <param name="id">From angular controller</param>
        /// <param name="task">From angular controller</param>
        /// <returns></returns>
        public IHttpActionResult Put(int id, Task task)
        {
            if (id != task.FeatureId)
            {
                return BadRequest();
            }
            else
            {
                using (AngularContext db = new AngularContext())
                {
                    Task getTask = db.Tasks.Find(id);
                    getTask.FeatureId = task.FeatureId;
                    getTask.DeveloperId = task.DeveloperId;
                    getTask.Open = task.Open;
                    getTask.WorkLoad = task.WorkLoad;
                    getTask.Description = task.Description;
                    getTask.ClosingDate = task.ClosingDate;
                    db.SaveChanges();

                    return CreatedAtRoute("DefaultApi", new { Id = task.TaskId }, task);
                }
            }
        }
コード例 #12
0
        public IHttpActionResult Put(int id, Developer developer)
        {
            if (id != developer.DeveloperId)
            {
                return BadRequest();
            }
            using (AngularContext contextObj = new AngularContext())
            {
                Developer getEmployee = contextObj.Developer.Find(id);
                getEmployee.Name = developer.Name;
                getEmployee.Salary = developer.Salary;
                contextObj.SaveChanges();

                return CreatedAtRoute("DefaultApi", new { Id = developer.DeveloperId }, developer);
            }
        }