public bool AddPet(IPet pet) { using (IDal dal = new ProtoDBContext()) { var mapper = new ProtoPetMap(dal); var dbmodel = mapper.Map(pet as IModel); return dal.AddPet(dbmodel as ProtoPetModel); } }
public bool? AddPet(AddPetMessage message) { using (IDal dal = new ProtoDBContext()) { var user = dal.GetUserByName(Thread.CurrentPrincipal.Identity.Name); if (user == null) return null; if (user.ID != message.UserId) return null; var petmapper = new ProtoPetMap(dal); return dal.AddPet(petmapper.Map(message.Model) as IPet); } }