private string Create_Controller_Code_Delete(string template) { StringBuilder sb = new StringBuilder(); sb.AppendLine(" /// <summary>"); sb.AppendLine(" /// Delete selected " + entity_name); sb.AppendLine(" /// </summary>"); sb.AppendLine(" /// <param name=\"id\"></param>"); sb.AppendLine(" /// <returns></returns>"); sb.AppendLine(" [Route(\"api/" + entity_sub_namespace + "/Delete\")]"); sb.AppendLine(" [PermissionVerify(new CommonEnum.Operations[] { CommonEnum.Operations.Delete })]"); sb.AppendLine(" [HttpDelete]"); sb.AppendLine(" public IHttpActionResult Delete(" + NameHelper.Get_ViewModel_DeleteModel(entity_name) + " model)"); sb.AppendLine(" {"); sb.AppendLine(" var command = new DeleteCommand() { ID = model.id };"); sb.AppendLine(""); sb.AppendLine(" CommandBus.Send(command);"); sb.AppendLine(" if (NeedRecordSystemLog(Operations.Delete)) "); sb.AppendLine(" {"); sb.AppendLine(" RecordSystemLog(JsonConvert.SerializeObject(command), null, \"All\", Operations.Delete);"); sb.AppendLine(" }"); sb.AppendLine(" return CommandResult(command.ExecuteResult);"); sb.Append(" }"); template = template.Replace("{{Delete-Actions}}", sb.ToString()); return(template); }