public async Task <IActionResult> PutManufacter(int id, Manufacter manufacter)
        {
            if (id != manufacter?.ManufacterId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <ActionResult <Manufacter> > PostManufacter(Manufacter manufacter)
        {
            _context.Manufacter.Add(manufacter);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetManufacter", new { id = manufacter?.ManufacterId }, manufacter));
        }
 public Car(Manufacter manufacter, Model model, String colorName, Motorization motorizationType, Packages package)
 {
     this.manufacter   = manufacter;
     this.model        = model;
     this.color        = colorName;
     this.motorization = motorizationType;
     this.package      = package;
     counter++;
 }
 public Car()
 {
     this.manufacter   = Manufacter.Unknown;
     this.model        = Model.Unknown;
     this.color        = "Unknown";
     this.motorization = Motorization.Unknown;
     this.package      = Packages.Unknown;
     counter++;
 }
示例#5
0
        public ActionResult Create(Manufacter manufacterToCreate)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            _db.Manufacter.Add(manufacterToCreate);
            _db.SaveChanges();
            return(View());
        }
示例#6
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Manufacter = await _context.Manufacter.FirstOrDefaultAsync(m => m.MID == id);

            if (Manufacter == null)
            {
                return(NotFound());
            }
            return(Page());
        }
示例#7
0
        public ActionResult Edit(Manufacter manufacterToEdit)
        {
            var originalManufacter = (from m in _db.Manufacter
                                      where m.manuID == manufacterToEdit.manuID
                                      select m).First();

            if (!ModelState.IsValid)
            {
                return(View("Index"));
            }
            _db.Entry(originalManufacter).CurrentValues.SetValues(manufacterToEdit);
            _db.SaveChanges();

            return(RedirectToAction("Index"));
        }
示例#8
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Manufacter = await _context.Manufacter.FindAsync(id);

            if (Manufacter != null)
            {
                _context.Manufacter.Remove(Manufacter);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
 public void SetManufacter(int i)
 {
     this.manufacter = (Manufacter)i;
 }
示例#10
0
 public override int GetHashCode()
 {
     return(Manufacter.GetHashCode() + Model.GetHashCode());
 }