public bool Post(int id) { bool R = false; try { O.Product BDProduct = BD.Products.FirstOrDefault(x => x.Id == id); if (BDProduct.Active) { BDProduct.Active = false; R = false; } else { BDProduct.Active = true; R = true; } BD.SaveChanges(); } catch { } return(R); }
public long Post(M.Product producto) { O.Product BDProduct = new O.Product { Name = producto.Name, Type = producto.Type, TypeDescription = producto.TypeDescription, AttendantName = producto.AttendantName, AttendantWebPage = producto.AttendantWebPage, AttendantEmail = producto.AttendantEmail, AttendantPhone = producto.AttendantPhone, Latitude = producto.Latitude, Longitude = producto.Longitude, Date = producto.Date, Active = producto.Active, CreationDate = System.DateTime.Now, CreationHourZone = System.TimeZoneInfo.Local.ToString(), Avatar = producto.Avatar, NameAvatar = producto.NameAvatar, IdPackage = producto.IdPackage }; BD.Products.Add(BDProduct); BD.SaveChanges(); return(BDProduct.Id); }
public string Post(long idProduct) { string S = ""; try { O.Product BDProduct = BD.Products.FirstOrDefault(x => x.Id == idProduct); BD.Products.Remove(BDProduct); BD.SaveChanges(); S = BDProduct.NameAvatar; } catch { } return(S); }
public bool Post(M.ParametrosPutAvatar parametrosPutAvatar) { bool S = false; try { O.Product producto = BD.Products.FirstOrDefault(x => x.Id == parametrosPutAvatar.Id); producto.Avatar = parametrosPutAvatar.DownloadURL; producto.NameAvatar = parametrosPutAvatar.FileName; BD.SaveChanges(); S = true; } catch { S = false; } return(S); }