示例#1
0
        public async Task <IActionResult> PutCompany([FromBody] Company model)
        {
            var company = _context.Companies.Find(model.Id);

            company.Name        = model.Name;
            company.Address     = model.Address;
            company.PhoneNumber = model.PhoneNumber;
            company.EditedDate  = DateTime.Now;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch
            {
                return(Ok(false));
            }

            return(Ok(true));
        }
示例#2
0
        public async Task <IActionResult> PutTask([FromBody] TasksViewModel model)
        {
            var task = _context.Tasks.Find(model.Id);

            task.Priority   = model.Priority;
            task.TaskDesc   = model.TaskDesc;
            task.Deadline   = DateTime.ParseExact(model.Deadline, "d.M.yyyy", CultureInfo.InvariantCulture);
            task.EditedDate = DateTime.Now;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch
            {
                return(Ok(false));
            }

            return(Ok(true));
        }
示例#3
0
        public async Task <IActionResult> PutWorker([FromBody] Worker model)
        {
            var worker = _context.Workers.Find(model.Id);

            worker.FullName    = model.FullName;
            worker.Address     = model.Address;
            worker.PhoneNumber = model.PhoneNumber;
            worker.CompanyId   = model.CompanyId;
            worker.EditedDate  = DateTime.Now;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch
            {
                return(Ok(false));
            }

            return(Ok(true));
        }