/* Agregar un Profesional Afín */ public long Post(M.OtherPerson otraPersona) { O.OtherPerson BDOtherPerson = new O.OtherPerson { Name = otraPersona.Name, Profesion = otraPersona.Profesion, ProfesionDescription = otraPersona.ProfesionDescription, Email = otraPersona.Email, Phone = otraPersona.Phone, City = otraPersona.City, Latitude = otraPersona.Latitude, Longitude = otraPersona.Longitude, Ciprin = otraPersona.Ciprin, Active = false, CreationDate = System.DateTime.Now.ToString("g"), CreationHourZone = System.TimeZoneInfo.Local.ToString(), Avatar = "", NameAvatar = "", Views = 0, IdUser = otraPersona.IdUser }; BD.OtherPersons.Add(BDOtherPerson); BD.SaveChanges(); O.User BDUser = BD.Users.FirstOrDefault(x => x.Id == otraPersona.IdUser); BDUser.CountProfiles = BDUser.CountProfiles + 1; BD.SaveChanges(); return(BDOtherPerson.Id); }
public bool Post(long idOtherPerson) { bool R = false; try { O.OtherPerson BDOtherPerson = BD.OtherPersons.FirstOrDefault(x => x.Id == idOtherPerson); BDOtherPerson.Views = BDOtherPerson.Views + 1; BD.SaveChanges(); R = true; } catch { R = false; } return(R); }
/* Actualiza el avatar de un Profesional Afín */ public bool Post(M.ParametrosPutAvatar parametrosPutAvatar) { bool R = false; try { O.OtherPerson otraPersona = BD.OtherPersons.FirstOrDefault(x => x.Id == parametrosPutAvatar.Id); otraPersona.Avatar = parametrosPutAvatar.DownloadURL; otraPersona.NameAvatar = parametrosPutAvatar.FileName; BD.SaveChanges(); R = true; } catch { R = false; } return(R); }
/* Actualiza el avatar de un Profesional Afín */ /* Elimina un Profesional Afín */ public string Post(int idOtherPerson) { string R = ""; try { O.OtherPerson BDOtherPerson = BD.OtherPersons.FirstOrDefault(x => x.Id == idOtherPerson); BD.OtherPersons.Remove(BDOtherPerson); BD.SaveChanges(); O.User BDUser = BD.Users.FirstOrDefault(x => x.Id == BDOtherPerson.IdUser); BDUser.CountProfiles = BDUser.CountProfiles - 1; BD.SaveChanges(); R = BDOtherPerson.NameAvatar; } catch { } return(R); }
/* Agregar un Profesional Afín */ /* Activar/Desactivar Perfil Afín */ public bool Post(long idOtherPerson) { bool R = false; try { O.OtherPerson BDOtherPerson = BD.OtherPersons.FirstOrDefault(x => x.Id == idOtherPerson); if (BDOtherPerson.Active) { BDOtherPerson.Active = false; R = false; } else { BDOtherPerson.Active = true; R = true; } BD.SaveChanges(); } catch { } return(R); }