public HttpResponseMessage CreateFeature([ModelBinder(typeof(IocCustomCreationConverter))] ISOFeature featureEntity)
        {
            try
            {
                var result = featureService.CreateFeature(featureEntity);

                if (result)
                {
                    return(CreateHttpResponse <ISOFeature>(
                               HttpStatusCode.Created,
                               HttpCustomStatus.Success,
                               null,
                               GetLocalisedString("msgFeatureCreation")));
                }

                return(CreateHttpResponse <ISOFeature>(
                           HttpStatusCode.Accepted,
                           HttpCustomStatus.Failure,
                           null,
                           GetLocalisedString("msgFeatureDuplicate")));
            }
            catch (Exception ex)
            {
                this.logger.Error(ex.Message);
                return(CreateHttpResponse <ISOFeature>(HttpStatusCode.ExpectationFailed,
                                                       HttpCustomStatus.Failure,
                                                       null,
                                                       GetLocalisedString("msgWebServiceError")));
            }
        }
        public IActionResult CreateFeature(FeatureModel model)
        {
            ViewBag.IsLogin = !string.IsNullOrEmpty(cache.GetString("user"));
            if (ViewBag.IsLogin)
            {
                ViewBag.User = JsonConvert.DeserializeObject <AccountModel>(cache.GetString("user"));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }

            if (ModelState.IsValid)
            {
                var project = projectSvc.GetProject(model.Project_id);
                var isValid = ValidateClosingDate(true, project, model);
                if (!isValid)
                {
                    PrepareDataForDisplay(model.Project_id);
                    return(View(model));
                }
                model.ClosingDate = model.ClosingDate.AddDays(1);
                if (!string.IsNullOrEmpty(model.BeAssignedMember_id))
                {
                    model.AssginByMember_id = model.CreateByMember_id;
                }

                featureSvc.CreateFeature(model);
                return(RedirectToAction("Index", "Project", new { projectid = model.Project_id }));
            }
            return(View(model));
        }
Beispiel #3
0
        public async Task <IActionResult> Post([FromBody] FeatureRequest feature)
        {
            if (!IsValidTimeSpan(feature.Lifetime))
            {
                return(BadRequest("lifetime could not be parsed"));
            }

            var newFeature = await _featureService.CreateFeature((Feature)feature);

            if (newFeature == null)
            {
                return(StatusCode((int)HttpStatusCode.Conflict));
            }

            return(CreatedAtRoute("GetFeature", new { FeatureId = newFeature.Id }, (FeatureResponse)newFeature));
        }
Beispiel #4
0
 public IActionResult Post([FromBody] Feature feature)
 {
     _featureService.CreateFeature(feature);
     return(Created("", feature));
 }
Beispiel #5
0
 // POST api/<controller>
 public void Post(FeatureViewModel featuretype)
 {
     _featuretypeService.CreateFeature(featuretype);
 }