Пример #1
0
        // POST api/Organizations
        public OrganizationDto Post([FromBody] OrganizationDto organization)
        {
            var newOrganization = organization.ConvertFromDto();

            OrganizationService.Add(newOrganization);
            return(newOrganization.ConvertToDto());
        }
Пример #2
0
        public ActionResult Create(OrganizationViewModel organization)
        {
            //OrganizationService os = new OrganizationService();
            try
            {
                if (ModelState.IsValid)
                {
                    organization o = new organization();
                    //o.id = organization.id;
                    o.name        = organization.name;
                    o.type        = organization.type;
                    o.PresidentID = organization.PresidentID;
                    o.Location    = organization.Location;

                    os.Add(o);
                    os.Commit();

                    Session["organization"] = o;
                    return(RedirectToAction("Index"));
                }
                return(View());
            }
            catch
            {
                return(View());
            }
        }