예제 #1
0
        public async Task <IActionResult> PutProjectsEmployees(int id, ProjectsEmployees projectsEmployees)
        {
            if (id != projectsEmployees.IdTasksEmployees)
            {
                return(BadRequest());
            }

            _context.Entry(projectsEmployees).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectsEmployeesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #2
0
        public async Task <IActionResult> PutTasks(int id, Tasks tasks)
        {
            if (id != tasks.Idtask)
            {
                return(BadRequest());
            }

            _context.Entry(tasks).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TasksExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #3
0
        public async Task <IActionResult> PutEmployees(short id, Employees employees)
        {
            if (id != employees.IdEmployee)
            {
                return(BadRequest());
            }

            _context.Entry(employees).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            var response = new
            {
                status = "Ok",
                name   = "Все ок"
            };

            return(Ok(response));
        }
예제 #4
0
        public async Task <IActionResult> Put(int id, [FromBody] emp emp)
        {
            if (id != emp.Id)
            {
                return(BadRequest());
            }

            _context.Entry(emp).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #5
0
 public ActionResult Edit([Bind(Include = "Id,Name")] MApplication mApplication)
 {
     if (ModelState.IsValid)
     {
         db.Entry(mApplication).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(mApplication));
 }
예제 #6
0
 public ActionResult Edit([Bind(Include = "Id,Username,FirstName,LastName,EMail")] MUser mUser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(mUser).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(mUser));
 }
예제 #7
0
 public ActionResult Edit([Bind(Include = "Id,StreetAddress,City,State,Zip")] MAddress mAddress)
 {
     if (ModelState.IsValid)
     {
         db.Entry(mAddress).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(mAddress));
 }