public Organization Parse(OrganizationModel model)
        {
            try
            {
                var organization = new Organization
                {
                    Name = model.Name,
                    OrganizationId = model.OrganizationId
                };

                //Below code is an example of how to get ID for url's pass in to the model
                //var uri = new Uri(model.URL);
                //var notificationId = int.Parse(uri.Segments.Last());

                return organization;
            }
            catch (Exception)
            {
                return null;
            }
        }
 public OrganizationModel Create(Organization organization)
 {
     return new OrganizationModel()
     {
         URL = _urlHelper.Link("Organizations", new {organizationid = organization.Id}),
         Name = organization.Name,
         OrganizationId = organization.OrganizationId,
         Users = organization.Users.Select(c => Create(c,false))
     };
 }
示例#3
0
        public bool AddOrganiztion(Organization entity)
        {
            try
            {
                _contex.Organizations.Add(entity);
                _contex.SaveChanges();

                return true;

            }
            catch (Exception)
            {
                return false;
            }
        }