Ejemplo n.º 1
0
        public IActionResult Post([FromBody] CreateEditViewModel model)
        {
            OrgUnit orgUnit = new OrgUnit();

            if (model.SuperiorID != null)
            {
                model.SuperiorID = EncryptionHelper.DecryptUrlParam(model.SuperiorID);

                int headerID = Int32.Parse(model.SuperiorID);
            }
            if (model.ParentID != null)
            {
                model.ParentID = EncryptionHelper.DecryptUrlParam(model.ParentID);
                int parent = Int32.Parse(model.ParentID);
            }

            var orgUnitMapper = _mapper.Map(model, orgUnit);

            _organizationUnitProvider.Add(orgUnitMapper);
            return(Ok(model));
        }
Ejemplo n.º 2
0
        public IActionResult Add([FromBody] AddOrganizationUnitInput unit)
        {
            int id = _orgUnitService.Add(unit);

            return(Created("", new { id }));
        }