public Zone ZoneEdited(ZoneVM Zonevm) { Zone Zone = ZoneMainOperation.GetById(Zonevm.ID); if (Zone != null) { Zone.Name = Zonevm.Name; Zone.NumberOfRooms = Zonevm.NumberOfRooms; Zone.Place = Zonevm.Place; Zone.Available = Zonevm.Available; Zone.Capacity = Zonevm.Capacity; if (Zonevm.ImageUrl != null) { Zone.ImageUrl = fileUploadService.upload(Zonevm.ImageUrl); } //else add a profile avatar image ZoneMainOperation.Update(Zone); ZoneMainOperation.Save(); } return(Zone); }
public Sponsor SponsorAdded(SponsorVM sponsorVM) { Sponsor Sponsor = new Sponsor(); if (sponsorVM.ImageName != null) { Sponsor.ImageName = fileUploadService.upload(sponsorVM.ImageName); } //else add a profile avatar image SponsorMainOperation.Insert(Sponsor); SponsorMainOperation.Save(); return(Sponsor); }
public UserVm register(RegisterViewModel register) { var role = context.Roles.Where(r => r.Name == register.Role).FirstOrDefault(); User user = new User(); user.Email = register.Email; user.Password = Encrypt.GenerateSha256Hash(register.Password); user.PhoneNumber = register.PhoneNumber; user.Role = role; user.Role_id = role.ID; user.UserName = register.FName + register.LName; if (register.ImageUrl != null) { user.ImageUrl = fileUploadService.upload(register.ImageUrl); } //else add a profile avatar image var createduser = userRepository.Add(user); return(Authenticate(createduser.Email, createduser.Password)); }