Exemplo n.º 1
0
        public void EditMultimedia(MultimediaModel multi, string lat, string lon)
        {
            ProductCoordinateModel coor = dbb.ProductCoordinates.Find(multi.id);

            coor.Lat = lat;
            coor.Lon = lon;

            CategoryModel cate = dbb.Categories.FirstOrDefault(s => s.CategoryName == multi.Category.CategoryName);

            MultimediaModel model = dbb.Multimedia.FirstOrDefault(s => s.id == multi.id);

            model.Title          = multi.Title;
            model.SearchOrAskJob = multi.SearchOrAskJob;
            model.Price          = multi.Price;
            model.Street         = multi.Street;
            model.Town           = multi.Town;
            model.Coordinate     = coor;
            model.User           = multi.User;
            model.Type           = multi.Type;
            model.Brand          = multi.Brand;
            model.Model          = multi.Model;
            model.Capacity       = multi.Capacity;
            model.DateAdd        = multi.DateAdd;
            model.Category       = cate;
            model.Images         = multi.Images;
            model.Description    = multi.Description;

            dbb.SaveChanges();
        }
Exemplo n.º 2
0
        public void AddMultimedia(MultimediaModel model, string lat, string lon)
        {
            CategoryModel category = new CategoryModel
            {
                CategoryName = model.Category.CategoryName,
            };

            // dbb.Categories.Add(category);
            model.Category = category;

            ProductCoordinateModel coordinate = new ProductCoordinateModel
            {
                Lat = lat,
                Lon = lon
            };

            // dbb.ProductCoordinates.Add(coordinate);
            model.Coordinate = coordinate;

            dbb.Multimedia.Add(model);
            dbb.SaveChanges();
        }