Example #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());
        }
Example #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"));
 }
Example #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");
        }