Beispiel #1
0
        //Cập nhật Brand
        public async Task <bool> Update(LineInfoDto model)
        {
            var info = _mapper.Map <LineInfo>(model);

            info.LineID = _repoBuilding.FindAll().FirstOrDefault(x => x.Name.Equals(model.LineName)).ID;
            _repoLine.Update(info);
            return(await _repoLine.SaveAll());
        }
Beispiel #2
0
 public async Task <IActionResult> Update(LineInfoDto update)
 {
     update.CreatedDate = DateTime.Now;
     if (await _partService.Update(update))
     {
         return(NoContent());
     }
     return(BadRequest($"Updating LineInfo {update.ID} failed on save"));
 }
Beispiel #3
0
        public async Task <IActionResult> Create(LineInfoDto create)
        {
            if (_partService.GetById(create.ID) != null)
            {
                return(BadRequest("LineInfo ID already exists!"));
            }
            create.CreatedDate = DateTime.Now;
            if (await _partService.Add(create))
            {
                return(NoContent());
            }

            throw new Exception("Creating the part failed on save");
        }